Reputation: 712
After running:
ionic setup sass
And installing all dependencies, when I try to start gulp
, I have this error instead:
/Users/user/Sites/ionic/project/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:22
throw new Error('`libsass` bindings not found. Try reinstalling `node-sass`?');
^
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
I'm trying to reinstall node-sass, but no success so far. Any idea on how to fix this issue?
Thanks!
Upvotes: 2
Views: 634
Reputation: 298
I've just fixed problems with libsass or node-sass with this command:
$ sudo rm -rf node_modules/ && cat package.json | sed -i.bak 's/"gulp-sass": "^X.X.X"/"gulp-sass": "^2.0.4"/g' package.json && npm install && ionic lib update
Where X is the version of gulp-sass in your package.json
Explanation:
Remove the old files in node_modules. I'm not sure is necessary to use 'sudo' (in my case, yes).
$ sudo rm -rf node_modules/
Search and replace inside package.json updating gulp-sass version to ^2.0.4. It also creates a backup (package.json.bak),
$ cat package.json | sed -i.bak 's/"gulp-sass": "^X.X.X"/"gulp-sass": "^2.0.4"/g' package.json
Reinstall dependencies
$ npm install
Update the ionic lib in the project
ionic lib update
If you have any further problems be sure I try can help you...
Bye
Upvotes: 0
Reputation: 1148
This workaround has fixed all.
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 way 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
Upvotes: 1
Reputation: 7574
Are you on Node 4? That's a somewhat common issue with the new C bindings. Here's a solution that worked for a lot:
$ npm uninstall gulp-sass node-sass
$ npm install [email protected]
$ npm install gulp-sass
Upvotes: 0