Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sage: "Error: libsass bindings not found. Try reinstalling node-sass" #1309

Closed
digitaldreamd opened this issue Feb 8, 2015 · 12 comments
Closed

Comments

@digitaldreamd
Copy link

I got this error when running gulp in sage after npm install.
Not sure if this is relevant to others, or the correct way to fix it. I fixed gulp-sass to the specified version in sage package.json. ie:
"gulp-sass": "^1.2.4",
to
"gulp-sass": "1.2.4",

Then removed gulp-sass from node_modules and re-ran npm install. Gulp runs fine now.

Node v0.10.32
NPM Latest
Ubuntu 14.10

@drawcard
Copy link
Contributor

drawcard commented Feb 8, 2015

Just encountered this problem too. Tried @digitaldreamd's suggestion which wouldn't work. Every time I removed the ^ tilde symbol it would reappear after running sudo npm install --save-dev gulp-sass

After running following: gulp --production

Error output:

[14:51:39] 'styles' errored after 8.75 s
[14:51:39] Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:21:11)
    at Object.<anonymous> (/var/www/clients/xxxxxxx.com.au/wp-content/themes/build-sage/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:181:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/node_modules/gulp-sass/index.js:3:17)
    at Module._compile (module.js:456:26)

My package.json:

{
  "name": "sage",
  "version": "8.0.0",
  "author": "Ben Word <ben@benword.com>",
  "homepage": "http://roots.io/sage/",
  "private": true,
  "repository": {
    "type": "git",
    "url": "git://github.com/roots/sage.git"
  },
  "bugs": {
    "url": "https://github.com/roots/sage/issues"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "http://opensource.org/licenses/MIT"
    }
  ],
  "scripts": {
    "build": "bower install && gulp",
    "jshint": "gulp jshint",
    "jscs": "jscs gulpfile.js assets/scripts/*.js"
  },
  "engines": {
    "node": ">= 0.10.0"
  },
  "devDependencies": {
    "asset-builder": "^0.4.0",
    "browser-sync": "^2.0.0-rc9",
    "del": "^1.1.1",
    "gulp": "^3.8.10",
    "gulp-changed": "^1.1.0",
    "gulp-concat": "^2.4.3",
    "gulp-flatten": "0.0.4",
    "gulp-if": "^1.2.5",
    "gulp-imagemin": "^2.0.0",
    "gulp-install": "^0.2.0",
    "gulp-jshint": "^1.8.4",
    "gulp-less": "^2.0.1",
    "gulp-load-plugins": "^0.8.0",
    "gulp-pleeease": "^1.1.0",
    "gulp-plumber": "^0.6.6",
    "gulp-rename": "^1.2.0",
    "gulp-rev": "^3.0.0",
    "gulp-sass": "^1.3.2", //Caret keeps inserting itself after npm install command
    "gulp-sourcemaps": "^1.3.0",
    "gulp-uglify": "^1.0.1",
    "imagemin-pngcrush": "^4.0.0",
    "jshint-stylish": "^1.0.0",
    "lazypipe": "^0.2.2",
    "merge-stream": "^0.1.7",
    "node-sass": "^2.0.0-beta",
    "traverse": "^0.6.6",
    "wiredep": "^2.1.0",
    "yargs": "^2.1.1"
  }
}

Any pointers to stop that ^ from showing up would be greatly appreciated!

Running: NPM 1.4.28, Node v0.10.36, Ubuntu 14.10, Vagrant 1.7.2

@austinpray
Copy link
Contributor

@digitaldreamd looking into this. Tangentially related to: #1311

@drawcard

# don't do this
sudo npm install --save-dev gulp-sass

I can try to break down why you are having trouble:

  1. You are using sudo with npm. Don't do that, it only leads to sadness and permissions issues. You should be using node with the correct permissions or using something like nvm. Highly recommend nvm.
  2. --save-dev is directly responsible for "Caret keeps inserting itself after npm install command". This is documented over at the npm install docs. I would just manually remove the caret and or npm install gulp-sass@1.2.4 without --save-dev

@digitaldreamd
Copy link
Author

@drawcard I would also do

npm install -g npm

to update npm

As @austinpray said if you have been using sudo with npm you will probably run into problems down the line. https://docs.npmjs.com/getting-started/fixing-npm-permissions

@drawcard
Copy link
Contributor

drawcard commented Feb 8, 2015

Cheers for that information @digitaldreamd & @austinpray 👍

I did the following:

  • Set up NVM and ensured I'm on node 0.10.x node -v
  • be careful, don't do this unless you know what you are doing: Fixed NPM permissions: sudo chown -R vagrant:vagrant /usr/local/ (also ran sudo chown -R vagrant:vagrant /home/vagrant/.npm
  • npm install -g npm
  • npm remove gulp-sass in theme dev folder
  • npm install gulp-sass@1.2.4 (It appears gulp-sass 1.3.2 doesn't work, complains about lib-sass)
  • Also ran npm install for good luck 🎱

And it looks like the compile went OK!

@drawcard
Copy link
Contributor

drawcard commented Feb 9, 2015

I encounted problems again switching from LESS to SASS:

[05:13:22] Using gulpfile /var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/gulpfile.js
[05:13:22] Starting 'clean'...
[05:13:22] Finished 'clean' after 5.82 ms
[05:13:22] Starting 'default'...
[05:13:22] Starting 'styles'...
[05:13:35] 'styles' errored after 13 s
[05:13:35] Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/node_modules/node-sass/lib/index.js:21:11)
    at Object.<anonymous> (/var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/node_modules/node-sass/lib/index.js:211:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/www/clients/xxxxxxxx.com.au/wp-content/themes/build-sage/node_modules/gulp-sass/index.js:3:17)
    at Module._compile (module.js:456:26)
[05:13:35] Finished 'default' after 13 s

But I ran the following which cleared it up:
npm rebuild node-sass which I discovered here. Just thought I'd share this in case anyone else was having grief.

@austinpray
Copy link
Contributor

@drawcard I'm going to try to help get a new version of node-sass out the door: sass/node-sass#602 (comment)

@drawcard
Copy link
Contributor

drawcard commented Feb 9, 2015

Thanks Austin! I'm sure that will help out a lot :)

@austinpray
Copy link
Contributor

I was able to get it to install under 0.12 by compiling it manually. You need GCC and stuff.

export SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
npm install

@retlehs retlehs closed this as completed Feb 13, 2015
@E-VANCE
Copy link
Contributor

E-VANCE commented Apr 28, 2015

@drawcard npm rebuild node-sass did it for me as well, thanks!

@kamdjouduplex
Copy link

after ran npm remove node-sass and run npm install node-sass it works thanks

@pownarthi
Copy link

I was using newer version of node and npm while getting this error. But it has already been mentioned in moodle site as
IMPORTANT: Don't use node 4.0 or higher, there are incompatibilities with some of the packages we use. Please use v0.12.7 instead.
So I installed node 12.7, started over again and this issue got resolved.

@VGerris
Copy link

VGerris commented Nov 22, 2016

I think node-sass depends on gulp-sass. If I understand correctly, some brilliant mind decided to keep the package name the same for major versions (must be logical somehow).
That means if you install node-sass you may have to set gulp-sass to version 2.0.0 or higher.
You also need to run it with the save-dev option:
https://www.npmjs.com/package/gulp-sass

I use node 4.6.2 and that worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants