Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libsass bindings not found when using node-sass in nodejs

I want to use the node-sass module in my node.js v0.12 application to benefit from the performance of libsass.
I executed npm i node-sass to install the module, no errors so far.

Now the mess starts:
If I just open the REPL in a terminal to try out node-sass then everything works fine but if I include it in my project files and run node myfile.js then I get the following error message:

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

The module's description at npmjs.com states that there might be a problem with resolving #!/usr/bin/env node under Ubuntu and how to fix this but that is not the case on my machine.
I could not find anything useful so I hope that you might help me.

I'm using node v0.12.2 under Ubuntu 14.10.

P.S.: I already tried to reinstall node-sass but without success. Nothing changes.

like image 672
TorbenJ Avatar asked Apr 05 '15 20:04

TorbenJ


People also ask

Can not install node-Sass?

If you still get the "Cannot find module 'node-sass'" error, open your package. json file and make sure it contains the node-sass package in the devDependencies object. Copied! You can try to manually add the line and re-run npm install .

Why do I have to rebuild node-Sass?

x This usually happens because your environment has changed since running `npm install`. Run `npm rebuild node-sass` to download the binding for your current environment. To make node-sass available in your source code, npm needs to build the package and create a binding for your environment.


1 Answers

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 
like image 141
Wilson Silva Avatar answered Oct 15 '22 02:10

Wilson Silva