Unable to install node-sass in my project [closed]

半腔热情 提交于 2019-12-06 06:21:21

问题


I am doing wes-bos Learn Node course. When I run npm start it shows - cannot find module node-sass. And when I try to run npm install node-sass --save, it gives me the following errors.


回答1:


Uninstall node-sass: npm uninstall node-sass Delete 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.

If this doesn't work, Try to rebuild node-sass:

npm rebuild node-sass

If that too doesn't work then i suggest to delete package-lock.json, node-modules and npm cache folder and do npm install , to install all your dependencies again. make sure you have a package.json file with all your dependencies listed.

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 update to update the package-lock.json file. to completely disable package-lock creation: npm config set package-lock false




回答2:


Try this

sudo npm install -g --unsafe-perm node-sass --save


来源:https://stackoverflow.com/questions/46515077/unable-to-install-node-sass-in-my-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!