Solved: Error using gulp-sass with VS2015 and Task Runner Explorer


In one of our projects we're using SASS as CSS extension. Together with Visual Studio 2015, Node and Gulp we've got a nice build process. Until I installed a new machine...
Suddenly our gulp-task to compile SASS files into CSS failed with a very descriptive error message:

Error: 'libsass' bindings not found. Try reinstalling 'node-sass'?

So first thing was trying to reinstall node-sass, but that is probably not the right way to go: we're using a node package gulp-sass which in turn is using the node-sass package. My thought was to look for a solution on their documentation page first:

gulp-sass is a very light-weight wrapper around node-sass, which in turn is a Node binding for libsass, which in turn is a port of Sass. Because of this, the issue you're having likely isn't a gulp-sass issue, but an issue with one of those three projects.

Ok that's clear, no gulp-sass issue. Next thing was to remove all the node modules (by the way rimraf is an awesome node package for that) and try reinstalling the node modules as mentioned on this StackOverflow question. No luck so far.

Apperently node-sass needs some kind of rebuild command, so removed al the node modules, re-installed every node module and then rebuild the node-sass package. Again: Error: 'libsass' bindings not found. Try reinstalling 'node-sass'?

Task Runner Explorer

Our gulp tasks are part of the build process in Visual Studio with the wonderful Task Runner Explorer, which showed me the error until now. I don't know why but I didn't try to run the gulp-task in the command-prompt which to my surprise succeeded!
So when the task runner explorer for Visual Studio tries to run my gulp-task it failed but running the task manually from the command-prompt works just fine....

After this I ran into a blog post from @mkristensen via this StackOverflow question and my problem was solved. Apparently Visual Studio 2015 is shipped with an older version of Node and uses that instead of the installed version on my machine.