NPM node-sass installation fails
You're using Node 12, and node-sass needs to be at least 4.12 to support that version https://github.com/sass/node-sass#node-version-support-policy
try this command it works for me
sudo npm install -g --unsafe-perm node-sass
After more than 2 hours of trying all sorts of ways (cleaning npm cache, deleting node_modules, trying to install with global switch -g
, etc.) to install node-sass and failing every time, I finally changed the mirror to china and it immediately worked for me!! (I know it kinda doesn't make any sense, considering the error I was getting)
Just for reference, this was the error I was receiving before it finally worked:
npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.14.0 postinstall: `node scripts/build.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@4.14.0 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR! C:\Users\****\AppData\Roaming\npm-cache\_logs\2020-06-06T13_56_56_768Z-debug.log
My Node version: v12.18.0
node-sass version in package.json: "^4.14.0"
I changed the mirror as stated in the node-sass npm page.
npm install -g mirror-config-china --registry=http://registry.npm.taobao.orgnpm install node-sass
Hope that helps.