node.js 尝试在节点 0.12 上重新安装 `node-sass`?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28409100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Try reinstalling `node-sass` on node 0.12?
提问by Takagi Akihiro
I would like to use google web starter kit. I installed node.js v0.12.0, node-sass& gulp.
我想使用 google web starter kit。我安装了 node.js v0.12.0, node-sass& gulp。
And then ran:
然后跑:
$ sudo npm install
When I typed gulp servethen got this error:
当我输入gulp serve然后得到这个错误:
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.
我重新安装了 node 和 gulp 但这没有帮助。
What should I do next?
我接下来该怎么做?
回答by Roma Rush
If your node version is 4 and you are using gulp-sass, then try
如果您的节点版本为 4 并且您使用的是 gulp-sass,请尝试
npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass@2
回答by Denis C de Azevedo
I found this useful command:
我发现了这个有用的命令:
npm rebuild node-sass
From the rebuilddocumentation:
从rebuild文档:
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.
当您安装新版本的节点(或切换节点版本)并且必须使用新的 node.js 二进制文件重新编译所有 C++ 插件时,这很有用。
http://laravel.io/forum/10-29-2014-laravel-elixir-sass-error
http://laravel.io/forum/10-29-2014-laravel-elixir-sass-error
回答by createbang
I ran into this error using node 0.12.0and it was fixed by deleting the existing /node_modulesdirectory and running npm update.
我使用 node 遇到了这个错误0.12.0,它通过删除现有/node_modules目录并运行npm update.
回答by Pupper
npm rebuild node-sasswas giving me errors (Ubuntu) and npm install gulp-sassdidn't make the error go away.
npm rebuild node-sass给了我错误(Ubuntu)并且npm install gulp-sass没有使错误消失。
Saw a solution on GitHub which worked for me:
在 GitHub 上看到一个对我有用的解决方案:
npm uninstall --save-dev gulp-sass
npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass
npm install --save-dev gulp-sass
回答by mikemaccana
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.
- 安装节点sass
- 在安装结束时被告知安装成功完成
- 然后被要求重新安装 node-sass。
The solution is to install node-sass version 2which supports current versions of node. See https://github.com/sass/node-sass/issues/490#issuecomment-70388754
解决方案是安装支持当前node.js 版本的 node-sass 版本 2。见https://github.com/sass/node-sass/issues/490#issuecomment-70388754
Run:
跑:
npm install node-sass@2
Then re-test:
然后重新测试:
$ npm ls node-sass
[email protected] /var/www/myapp
└── [email protected]
$ 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
回答by georger
If you use Gulp then try:
如果您使用 Gulp,请尝试:
npm install gulp-sass
npm install gulp-sass
I had the same problem and the gulp-sasspackage was the problem.
我有同样的问题,gulp-sass包裹是问题所在。
回答by bin2hex
i had the same problem today at work.
我今天在工作中遇到了同样的问题。
npm rebuild node-sass
npm rebuild node-sass
done the job for me
为我完成了工作
回答by natepers
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
将 Node 降级到 0.10.36 应该按照 node-sass github 页面上的这个线程执行:https: //github.com/sass/node-sass/issues/490#issuecomment-70388754
If you have NVM you can just:
如果你有 NVM,你可以:
nvm install 0.10
If you don't, you can find NVM and instructions here: https://www.npmjs.com/package/nvm
如果没有,您可以在此处找到 NVM 和说明:https: //www.npmjs.com/package/nvm
回答by ericsoco
This answer is a bit orthogonal to the the OP, but --
这个答案与 OP 有点正交,但是——
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:
libsass 绑定无法与 Node v4.0.0 上的 node-sass 包装器一起正确安装。我收到了与问题相同的错误消息(Error: 'libsass' bindings not found. Try reinstalling 'node-sass')但我最终卸载了 Node v4.0.0 并通过以下脚本使用 nvm 安装了 v0.12.7:
https://gist.github.com/brock/5b1b70590e1171c4ab54
https://gist.github.com/brock/5b1b70590e1171c4ab54
and now libsass and node-sass are behaving properly.
现在 libsass 和 node-sass 运行正常。
回答by 4m1r
you may also want to npm remove gulp-sassand re-install gulp-sass if you've switched node versions.
npm remove gulp-sass如果您切换了节点版本,您可能还想重新安装 gulp-sass。

