JMon
JMon

Reputation: 3447

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

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

Upvotes: 16

Views: 33764

Answers (7)

Vivek Gajbhiye
Vivek Gajbhiye

Reputation: 86

just use following command.

npm update

Upvotes: 0

Tailor Devendra
Tailor Devendra

Reputation: 449

Following steps worked for me.

  1. Remove node_modules folder.
  2. Remove package-lock.json file.
  3. Run sudo npm install -g --unsafe-perm node-sass
  4. Run npm install without sudo command.

Upvotes: 1

Hossein
Hossein

Reputation: 9

This is because of your incompatible node version with the node-sass module by the way node-sass is deprecated. check this link and select the best version with your node installed https://www.npmjs.com/package/node-sass

Upvotes: 0

Alireza Ebrahimkhani
Alireza Ebrahimkhani

Reputation: 551

try this command it should work successfully

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

it work for me

Upvotes: 2

Grant
Grant

Reputation: 6329

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.

Upvotes: 17

Joe Brinkman
Joe Brinkman

Reputation: 1892

It looks like this is documented on the Node-Sass page in NPM. Upgrade to Node-Sass v 4.12.0 and it will work with Node 12.

Upvotes: 4

JMon
JMon

Reputation: 3447

After battling with this issue for a considerable amount of hours, I downgraded from the Current version of Node (12.8.0) to the LTS (10.16.2) and it finally worked. So if you are having issues like mine, maybe try to downgrade the node version and it can help you

Upvotes: 0

Related Questions