可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I would like to use google web starter kit. I installed node.js v0.12.0, node-sass
& gulp
.
And then ran:
$ sudo npm install
When I typed gulp serve
then got this error:
Using gulpfile ~/web-starter-kit/gulpfile.js Starting 'styles'... 'styles' errored after 93 ms
Error: `libsass` bindings not found. Try reinstalling `node-sass`? at getBinding
I reinstalled node and gulp but this doesn't help.
What should I do next?
回答1:
If your node version is 4 and you are using gulp-sass, then try
npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass@2
回答2:
I found this useful command:
npm rebuild node-sass
From the rebuild
documentation:
This is useful when you install a new version of node (or switch node
versions), and must recompile all your C++ addons with the new node.js
binary.
http://laravel.io/forum/10-29-2014-laravel-elixir-sass-error
回答3:
I ran into this error using node 0.12.0
and it was fixed by deleting the existing /node_modules
directory and running npm update
.
回答4:
npm rebuild node-sass
was giving me errors (Ubuntu) and npm install gulp-sass
didn't make the error go away.
Saw a solution on GitHub which worked for me:
npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass
回答5:
I had the same issue:
- installing node-sass
- being told at the end of installation that the installation completed successfully
- then being asked to re-install node-sass.
The solution is to install node-sass version 2 which supports current versions of node. See https://github.com/sass/node-sass/issues/490#issuecomment-70388754
Run:
npm install node-sass@2
Then re-test:
$ npm ls node-sass
myapp@0.0.0 /var/www/myapp
└── node-sass@2.0.1
$ gulp sass
[09:48:42] Using gulpfile /var/www/myapp/gulpfile.js
[09:48:42] Starting 'sass'...
[09:48:42] Finished 'sass' after 15 ms
回答6:
If you use Gulp then try:
npm install gulp-sass
I had the same problem and the gulp-sass
package was the problem.
回答7:
Downgrading Node to 0.10.36 should do it per this thread on the node-sass github page: https://github.com/sass/node-sass/issues/490#issuecomment-70388754
If you have NVM you can just:
nvm install 0.10
If you don't, you can find NVM and instructions here: https://www.npmjs.com/package/nvm
回答8:
i had the same problem today at work.
npm rebuild node-sass
done the job for me
回答9:
This answer is a bit orthogonal to the the OP, but --
libsass bindings don't install properly with the node-sass wrapper on Node v4.0.0. I got the same error message as in the question (Error: 'libsass' bindings not found. Try reinstalling 'node-sass')
but I ended up uninstalling Node v4.0.0 and installing v0.12.7 using nvm, via this script:
https://gist.github.com/brock/5b1b70590e1171c4ab54
and now libsass and node-sass are behaving properly.
回答10:
you may also want to npm remove gulp-sass
and re-install gulp-sass if you've switched node versions.
回答11:
I have same issue when gulp-sass version is 1.3.0, and fix it after upgrading to 2.1.0.
回答12:
If you came here because you upgraded nodejs systemwide & suddenly your emberjs ^1.13 app is failing with this message, make sure you're not using an outdated version of ember-cli-sass
. You'll need to rm -rf node_modules bower_components dist tmp
within the Ember app, then update your package.json
with the appropriate ember-cli-sass
version, and finally npm install --save-dev
. This fixed it for me, without having to rebuild or change any other dependencies.
回答13:
I removed all the /node_modules
folder then ran npm install
and it worked.
I have node v5.5.0, npm 3.3.12
回答14:
For me, this issue was caused in my build system (Travis CI) by doing something kind of dumb in my .travis.yml
file. In effect, I was calling npm install
before nvm use 0.12
, and this was causing node-sass
to be built for 0.10
instead of 0.12
. My solution was simply moving nvm use
out of the .travis.yml
file’s before_script
section to before the npm install
command, which was in the before_install
section.
In your case, it is likely that whatever process you are starting with gulp
is using a different version of node
(than what you would expect).
回答15:
I had the same issue as @Kos had, only for some reason I had to modify the gulp-sass package from the old package.json
file I had. It then installed the dependencies currently and now it finally works!
回答16:
My issue was that I was on a machine with node version 0.12.2
, but that had an old 1.x.x
version of npm
. Be sure to update your version of npm: sudo npm install -g npm
Once that is done, remove any existing node-sass
and reinstall it via npm.
回答17:
You need to use the right version. Try:
nvm use 0.12