Failed at the [email protected] postinstall script. Cannot manage to run this

JMon picture JMon · Aug 6, 2019 · Viewed 12.2k times · Source

I have gone through all the questions regarding this issue but I cannot seem to find anything that works.

I am getting this error :-

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I have tried to remove the node_modules and npm install again. I also tried to remove the node-sass folder in the node_modules and npm install -g node-sass@latest did not work too. I also tried

npm install -g node --unsafe-perm=true --allow-root

and

npm uninstall node-sass
npm cache clean --force
npm install -g node-sass@latest

but nothing seems to be working at all. Is there someone who can shed some light on this please?

Thanks for your time

Answer

Grant picture Grant · Nov 28, 2019

Unless you're working on some sort of shared project that has strict requirements you can do the following to overcome the issue:

1.) Delete your package.lock file - which indicates the versions to be locked at.

2.) Delete your node_modules folder which contains all the original installations and C++ binary compilations.

3.) Then npm install it all back and npm rebuild for good measure.