Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while installing npm packages npm ERR! code ELIFECYCLE

Don't know what happened but I receive the following error while

>npx create-react-app .
>npm i <packages>
>npm install 

and so on, so none of the commands above work

the error:

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Program Files\git\bin\bash.exe
npm ERR! file C:\Program Files\git\bin\bash.exe
npm ERR! path C:\Program Files\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! [email protected] postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn C:\Program Files\git\bin\bash.exe ENOENT
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've seen that it's mostly Windows problem but I work with Mac

like image 344
Aaamrk__ Avatar asked Oct 17 '25 18:10

Aaamrk__


2 Answers

Open CMD as administrator and then run:

npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
like image 53
Zvi Redler Avatar answered Oct 19 '25 08:10

Zvi Redler


https://github.com/facebook/create-react-app/issues/8441 this might help you. Might be because of the wrong bash!

like image 45
Venkatesh A Avatar answered Oct 19 '25 09:10

Venkatesh A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!