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

I’ve been struggling with this for the last 2 hours and I don’t know what is going on, I already went into every post about this on Google and I am getting the same problem every time I try something new

node version: 4.2.6
npm version: 2.5.1 

when I do grunt serve, this is what I get

CRSJOPGP0223:promo-multiproduct-oaa2 berretan$ grunt serve
Loading "sass.js" tasks...ERROR
>> Error: `libsass` bindings not found. Try reinstalling `node-sass`?

Running "serve" task

Running "clean:server" (clean) task
>> 1 path cleaned.

Running "concurrent:server" (concurrent) task

    Loading "sass.js" tasks...ERROR
    >> Error: `libsass` bindings not found. Try reinstalling `node-sass`?

    Running "copy:css" (copy) task


    Done, without errors.


    Execution Time (2016-03-30 19:05:07 UTC)
    loading tasks  2s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99%
    Total 2.1s

    Loading "sass.js" tasks...ERROR
    >> Error: `libsass` bindings not found. Try reinstalling `node-sass`?

    Running "jshint:all" (jshint) task
    >> 9 files lint free.

    Done, without errors.


    Execution Time (2016-03-30 19:05:07 UTC)
    loading tasks     2s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 87%
    jshint:all     288ms  ▇▇▇▇▇▇ 12%
    Total 2.3s
        Warning: OptionParser::InvalidOption: invalid option: --source-map
      Use --trace for backtrace. Use --force to continue.

        Aborted due to warnings.


Execution Time (2016-03-30 19:05:05 UTC)
loading tasks      1.5s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 34%
concurrent:server  2.9s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 66%
Total 4.4s

here my packege.json file

{
  "name": "oaa-recipe-c",
  "app": "app",
  "dist": "dist",
  "version": "0.0.0",
  "dependencies": {
    "bower": "~1.3.9",
    "metrojs": "^0.9.77"
  },
  "devDependencies": {
    "assemble": "~0.4.42",
    "grunt": "~0.4.5",
    "grunt-autoprefixer": "~2.2.0",
    "grunt-bower-install": "~1.4.0",
    "grunt-concurrent": "~1.0.0",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-contrib-compress": "~0.8.0",
    "grunt-contrib-concat": "~0.5.0",
    "grunt-contrib-connect": "~0.9.0",
    "grunt-contrib-copy": "~0.8.0",
    "grunt-contrib-cssmin": "~0.12.0",
    "grunt-contrib-htmlmin": "~0.4.0",
    "grunt-contrib-imagemin": "~0.7.1",
    "grunt-contrib-jshint": "~0.11.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-uglify": "~0.8.0",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-exec": "~0.4.5",
    "grunt-notify": "^0.4.0",
    "grunt-rev": "~0.1.0",
    "grunt-sass": "~0.18.1",
    "grunt-stripmq": "~0.0.6",
    "grunt-svgmin": "~2.0.1",
    "grunt-usemin": "~3.0.0",
    "grunt-wiredep": "^1.7.0",
    "load-grunt-tasks": "~3.1.0",
    "node-sass": "*",
    "time-grunt": "~1.1.0"
  },
  "engines": {
    "node": ">=0.10.0"
  }
}

I am getting crazy, how is possible that there is no standard way to bypass this or a message providing the solution? even if I do npm rebuild node-sass or npm install node-sass as suggested in the terminal error, I get the same at the end.

what do you think it is?

UPDATE

See how I fixed this issue

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 26 (4 by maintainers)

Most upvoted comments

Just got the solution for this, you should have the Node version according to the node-sass version, the way I did it:

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

now, you should be specific on your error message, it doesn’t say anything.

UPDATE: I’ve seen some people still asking for this on 2019. It is way easier to fix it than when I got the solution for the first time:

Every time you change your node version just run: npm rebuild node-sass

ig:

nvm use 10.15.0
npm rebuild node-sass

And it will make the trick.

Just to throw my recent two cents in. I had this exact issue, the cause was the version of gulp-sass. It was below version 2.0.0 which has a critical bug. Which can be read here. Once I changed the version in the package.json file to ^2.0.0 it worked as normal.

I upgraded my node-sass to the latest version and everything worked (package.json).

This is a local environment issue. I’ve provided all the information necessary to correct your environment. This issue has gotten off track and no longer serves a constructive purpose.

What’s the result of

npm ls node-sass

For what it’s worth, I’m getting this error in Visual Studio because I did npm install from my bash shell. Visual Studio is only 32 bit, but since it wasn’t the tool that ran ‘npm install’ it must have grabbed the “wrong” version. For me, deleting the node_modules and having Visual Studio reinstall it, fixes this problem.

It doesn’t fix the problem of me using Visual Studio 😕

I had this same issue. deleting the node_modules/node-sass folder and running npm install fix this particular error. However, now I’m getting ERROR in Module did not self-register.
When I run ./node_modules/.bin/node-sass --version I get

module.js:440
  return process.dlopen(module, path._makeLong(filename));

Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:440:18)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/home/vagrant/node_modules/node-sass/lib/index.js:16:15)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

Please check the output of npm config ls. Probably you have ignore-scripts = true

remove this line in ~/.npmrc

This is crazy hacky and might not work for you, but I had a coworker send me their node_modules/node-sass/vendor/. I dropped it in and it worked.

vendor.zip