Automatically fix known npm dependency vulnerabilities with npm audit fix

domain: registry.npmjs.org · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Make sure you have a package-lock.json or npm-shrinkwrap.json present — npm audit requires one by default
  2. Run npm audit fix to let npm install compatible (non-vulnerable) versions of affected dependencies
  3. Limit the blast radius with npm audit fix --only=prod to skip devDependencies, or --package-lock-only to update only the lockfile without touching node_modules
  4. Run a true dry run with JSON output first: npm audit fix --dry-run --json to see exactly what would change
  5. If fixes require changing declared dependency ranges at the root, run npm audit fix --force (this allows semver-major updates to top-level deps; use with care)
  6. Re-run npm audit afterwards to confirm zero remaining vulnerabilities

Known gotchas

Related routes

Use OSV-Scanner guided remediation to identify which dependency updates resolve the most vulnerabilities
osv.dev · 5 steps · unrated
Automate Snyk Fix pull requests for open source vulnerabilities through SCM integration settings
docs.snyk.io · 5 steps · unrated
Patch a broken npm dependency in place with pnpm patch and pnpm patch-commit
pnpm.io · 6 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans