0

I am using Visual Studio Code on MacOS latest version.

I am getting many errors when I try to run npm start that I have posted in a separate question here:

I thought to install all possible modules again to solve the issue when I try to run:

npm i -g npm

I even get errors that part of that is copied here:

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 fsevents@1.2.11: fsevents 1 will break on node v14+ and 
could be using insecure binaries. Upgrade to fsevents 2.

I tried to fix the issue using this article:

but when running "npm audit fix" i get a new set of errors:

npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/afshinshahpari/.npm/_logs/2021-08-16T12_46_15_639Z-debug.log

in order to solve it, I used

npm i --package-lock-only

but no success.

SharpC
  • 6,974
  • 4
  • 45
  • 40
albert sh
  • 1,095
  • 2
  • 14
  • 31

1 Answers1

0

Here's the solution bro try this.

Step 1:

$ npm cache clean --force

Step 2

Delete node_modules by

$ rm -rf node_modules package-lock.json folder

or delete it manually by going into the directory and right-click > delete / move to trash. Also, delete package-lock.json file too.

Step 3

npm install

To start again,

$ npm start

This worked for me. Hopes it works for you too.

PS: If it is still there, kindly check the error it is displaying in red and act accordingly. This error is specific to Node.js environment.

SharpC
  • 6,974
  • 4
  • 45
  • 40
AliRehman
  • 1
  • 1
  • 1
    Thank you for your answers, but I had already tried these steps and when running "npm install" I get a new error: npm ERR! code ENOLOCK npm ERR! audit This command requires an existing lockfile. – albert sh Aug 16 '21 at 13:26