libsass bindings not found when using node-sass in nodejs

If you're using node 4.x or later then you need to reinstall gulp-sass with:

npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass@2

You’ve probably tried to reinstall node-sass while using

npm install node-sass

or

npm uninstall node-sass
npm install node-sass

But node-sass is a C version of Sass. You have to use npm rebuild:

npm rebuild node-sass

I fixed this issue by deleting the existing /node_modules folder and running npm update


This is the only solution that worked for me,

sudo npm install -g n
sudo n 0.12.7
npm install node-sass@2
sudo npm -g install node-gyp@3
npm rebuild node-sass

This workaround (http://forum.ionicframework.com/t/error-running-gulp-sass/32311/20) worked form me.

Starting with this setup:

Cordova CLI: 5.3.3 Gulp version: CLI version 3.9.0 Gulp local: Local version 3.9.0 Ionic Version: 1.1.0 Ionic CLI Version: 1.6.5 Ionic App Lib Version: 0.3.9 ios-deploy version: Not installed ios-sim version: 5.0.1 OS: Mac OS X Yosemite Node Version: v4.1.1 Xcode version: Xcode 6.4 Build version 6E35b

I've found a solution to avoid to use 'sudo' command. We need before to fix npm permissions following this: https://docs.npmjs.com/getting-started/fixing-npm-permissions and fixing permissions for Node here: http://mawaha.com/permission-fix-node-js/ After this we can check and reinstall software without 'sudo' for npm, n or ionic.

I followed this step:

npm install -g n
rm -R node_modules/ 
npm install [email protected] 
npm -g install node-gyp@3
npm uninstall gulp-sass
npm install gulp-sass@2 
npm rebuild node-sass 
ionic setup sass 

Why [email protected]? Because it works with latest ionic version: https://github.com/driftyco/ionic/pull/4449