I have a React Native project (0.61.4) that uses yarn
as its package manager.
When I run yarn audit
a huge number of vulnerabilities are reported:
18202 vulnerabilities found - Packages audited: 958823
Severity: 18202 High
✨ Done in 14.34s.
Most are in some very deep dependency paths. For instance:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=4.17.12 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-native │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ react-native > @react-native-community/cli > │
│ │ metro-react-native-babel-transformer > @babel/core > lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://www.npmjs.com/advisories/1065 │
└───────────────┴──────────────────────────────────────────────────────────────┘
When I run npm audit
, it first reports:
Neither npm-shrinkwrap.json nor package-lock.json found: Cannot audit a project without a lockfile
So I run:
npm i --package-lock-only
A package-lock.json
file is generated. On inspection this file seems correct.
When I now run npm audit
, the results are:
=== npm audit security report ===
found 0 vulnerabilities
I don't understand the discrepancy between these two package managers. Why does npm
report 0 errors, and yarn
18.202?