➜ npm audit
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
I ran npm audit and got this error.
When I run below:
➜ npm config get package-lock
true
➜ npm config get shrinkwrap
true
Can anybody help with this? as to how to fix it? and npm audit fix --force is not working as well...
If security vulnerabilities are found and updates are available, you can either: Run the npm audit fix subcommand to automatically install compatible updates to vulnerable dependencies. Run the recommended commands individually to install updates to vulnerable dependencies.
I just ran the command it says to.
npm i --package-lock-only
Then it showed me 0 vulnerabilities. Anyway, ran again audit fix and again 0 vulnerabilities.
works for me like this:
npm cache clean --force
npm fund
npm audit fix --force
The problem is that you need a package.json and package-lock.json file in the directory.
Running the following commands will fix it for you.
npm init -y
npm i --package-lock-only
npm audit
This fixes the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With