Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node-sass throw error when upgrade node to 4.0.0

i'm developing an ionic app, and i use sass. when i upgrade my node version to 4.0.0, there is an error throw out about node-sass. the error is blow:

ionic $ /Applications/My-Project/nearbook/nearbooks_ionic/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`?
    at getBinding (/Applications/My-Project/nearbook/nearbooks_ionic/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:22:11)
    at Object.<anonymous> (/Applications/My-Project/nearbook/nearbooks_ionic/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:188:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Applications/My-Project/nearbook/nearbooks_ionic/node_modules/gulp-sass/index.js:3:17)
    at Module._compile (module.js:460:26)

i have tried to reinstall all my node_modules (i delete node_modules folder and rerun node install) or run node rebuild node-sass but it still doesn't work.

when i downgrade my node version to 0.12.7 and reinstall all node_modules, my problem solved.

so i guess there is something wrong when node 4.0 compiling node-sass.

Anyone know how to fix this?

like image 453
Jack Zhang Avatar asked Sep 09 '15 03:09

Jack Zhang


People also ask

How do I upgrade sass from sass to node?

If you're a user of Node Sass, migrating to Dart Sass is straightforward: just replace node-sass in your package. json file with sass . Both packages expose the same JavaScript API. If you're using the SassC command-line interface, you can switch to Dart Sass's CLI.

How do I update a specific version of node?

You can run the npm update specific package command with a specific package name to update a specific package. Also, in some cases, to update a package to a specific version, you must use the npm install command with a version number followed by the package name.


1 Answers

make sure you're using gulp-sass 2.0.4 by getting the newest gulp-sass

npm install --save-dev gulp-sass

and it should install its dependency on node-sass 3.3.2 which has node 4.0 support https://twitter.com/nodesass/status/641607400651288576

like image 97
codecmd Avatar answered Sep 23 '22 00:09

codecmd