How To Fix npm audit error with loadVirtual and ENOLOCK & Deprecated Dependencies

The solution…

Aurora
ILLUMINATION

--

Photo by Mike Kotsch on Unsplash

By any chance which you might have encountered “npm WARN deprecated” messages after running certain commands such as installing npm packages globally, and at the end of it, it says:

To address all issues, run:
npm audit fix
Run `npm audit` for details.

After running ‘npm audit fix’, you might see:

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

The Solution:

Run the following commands:

npm i --package-lock-only
npm config get package-lock
npm config get shrinkwrap
npm i --package-lock-only
npm audit fix

(When running ‘npm config get package-lock’ and ‘npm config get shrinkwrap’, you will receive ‘true’ for both)

— → After running ‘npm audit fix’, you will see: “up to date, audited… found 0 vulnerabilities

--

--

Aurora
ILLUMINATION

⋆꙳•̩̩͙❅*̩̩͙‧͙ ‧͙*̩̩͙❆ ͙͛ ˚₊⋆