node.js 无法在我的项目中安装 node-sass
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46515077/
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
Unable to install node-sass in my project
提问by sugandh_g
回答by vikrant
Uninstall node-sass: npm uninstall node-sassDelete package-lock.json, and clean the cache: npm cache clean --force, then do npm update, npm install, npm update. then again try to install node sass: npm install node-sass.
卸载 node-sass:npm uninstall node-sass删除package-lock.json,并清理缓存:npm cache clean --force,然后执行npm update, npm install, npm update。然后再次尝试安装 node sass: npm install node-sass。
If this doesn't work, Try to rebuild node-sass:
如果这不起作用,请尝试重建 node-sass:
npm rebuild node-sass
If that too doesn't work then i suggest to delete package-lock.json, node-modulesand npm cachefolder and do npm install, to install all your dependencies again. make sure you have a package.json file with all your dependencies listed.
如果这也不起作用,那么我建议删除package-lock.json, node-modulesand npm cachefolder and do npm install,再次安装所有依赖项。确保您有一个 package.json 文件,其中列出了所有依赖项。
The package-lock.json file has some issues(it doesn't update when package.json changes) as mentioned here:https://github.com/npm/npm/issues/16866"Touching package.json by hand may make your package.json to be incompatible with package-lock.json". do npm updateto update the package-lock.jsonfile.
to completely disable package-lock creation:
npm config set package-lock false
package-lock.json 文件有一些问题(当 package.json 更改时它不会更新),如下所述:https: //github.com/npm/npm/issues/16866“手动触摸 package.json 可能会使您的 package.json 与 package-lock.json 不兼容”。执行npm update更新package-lock.json文件。完全禁用包锁创建:
npm config set package-lock false
回答by Kumar
Try this
尝试这个
sudo npm install -g --unsafe-perm node-sass --save


