Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to solve error code 1 when running"npm install"

when I try to run "npm install" I get errors that I have brought parts of them here:

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/local/lib/node_modules/node/bin/node 
/usr/local/lib/node_modules/npm/bin/npm-cli.js install --force -- 
cache=/Users/afshinshahpari/.npm --prefer-offline=false --prefer-online=false -- 
offline=false --no-progress --no-save --no-audit --include=dev --include=peer -- 
include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile 
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old 
version of npm,
npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the 
registry.
npm ERR! npm WARN old lockfile 
npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
npm ERR! npm WARN old lockfile 
npm ERR! npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and 
could be using insecure binaries. Upgrade to fsevents 2.

after reading few articles , I used many commands like this:

npm cache clean --force

or npm i --package-lock-only

But none of them fixed the issue, even some of them like "npm audit fix --force" showed other types of errors.

Any advice would be appreciated.

like image 730
albert sh Avatar asked May 15 '26 14:05

albert sh


1 Answers

What version of node and npm are you using?

I had the same error, spent hours Googling and trying the same things...

npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json

The error remained...

I ended up downgrading my version of npm to 6.14.15. I was using the latest version of npm which I believe is 7.something. I downgraded to 6.14.15 because that's the one that comes in the stable node.js download.

I don't have the details on why it worked or what's different in the versions but running npm i worked for me after downgrading.

like image 64
bibiwestside Avatar answered May 19 '26 03:05

bibiwestside