Loading…
Loading documentation...
Read what npm audit reports on a real project, tell a finding in your shipped code from one in your tools, and fix it without breaking the build.
Commands checked on 2026-10-13 with npm 11, Node.js 24, Next.js 16.4.
You will be able to read an audit report line by line, say whether a finding reaches the code your users run, choose between fixing, waiting and accepting, and put a check on your build server that fails for the findings that matter and stays quiet for the ones that do not.
package-lock.json. The examples come from a new Next.js 16.4 app, made as in Start a Next.js app with TypeScript, linting and a first test, on 2026-10-13. Your report will differ: advisories are published every day.npm audit
On a project created that same day, the report ended with:
5 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Five high findings in a new project look alarming. Read the report before you act on its last line.
braces *
Severity: high
braces vulnerable to stack-exhaustion denial of service through deeply nested patterns - https://github.com/advisories/GHSA-vfj7-8cjw-p6xm
fix available via `npm audit fix --force`
Will install eslint-config-next@14.2.35, which is a breaking change
node_modules/braces
micromatch >=0.2.0
Depends on vulnerable versions of braces
braces *: the package and the affected versions. * means every published version, so there is no newer one to move to.Will install eslint-config-next@14.2.35, which is a breaking change: the "fix" on offer is to go back two major versions of the linter configuration. That is not a fix.The report then lists the same advisory four more times, once for every package between you and braces. Five findings, one cause.
npm explain braces
Shortened here to the lines that name a package:
braces@3.0.3 dev
node_modules/braces
braces@"^3.0.3" from micromatch@4.0.8
micromatch@"^4.0.4" from fast-glob@3.3.1
fast-glob@"3.3.1" from @next/eslint-plugin-next@16.4.0
@next/eslint-plugin-next@"16.4.0" from eslint-config-next@16.4.0
dev eslint-config-next@"16.4.0" from the root project
Read it from the bottom: your project asks for the linter configuration, which brings a file matcher, which brings braces. The word dev on the first line is the important one. This package is a development tool. It is not in what you ship.
npm audit --omit=dev
found 0 vulnerabilities
The application your users run has no known finding. The five are in a tool that runs on your machine and your build server, on file patterns you wrote yourself. The advisory describes a denial of service through a pattern chosen by an attacker; your linter is never given one.
For each finding, one of four answers:
Update. A fixed version exists inside the range you already accept: npm audit fix installs it and changes only the lockfile. Run your tests afterwards.
Override. A fixed version exists, but a package in between pins the old one. Force it in package.json and install:
"overrides": {
"PACKAGE": "FIXED_VERSION"
}
An override is a promise to look again: remove it when the package in between has caught up.
Wait. No fixed version exists, as here. Write down the advisory and the date, and check again when the package is updated.
Replace. The package is abandoned and the finding reaches your users. Find another package.
Here the answer is to wait, and to say why in the place your team will read it. On this project npm audit fix changed neither file, because nothing safe was on offer.
npm audit --omit=dev --audit-level=high
The command exits with 0 when no finding of that level or above is in what you ship, and with 1 when one is. On our project npm audit --audit-level=high exits with 1 because of the linter, and the same command with --omit=dev exits with 0. Put the second one in your build. Run the first one by hand, or once a week, so that findings in your tools are seen without stopping every release.
npm audit --omit=dev --audit-level=high; echo "exit $?"
The line after the report reads exit 0 on a healthy project. To see the check fail on purpose, drop --omit=dev on a project like ours: it reads exit 1.
For a machine-readable report, npm audit --json gives the same findings with a count by severity under metadata.vulnerabilities:
{"info":0,"low":0,"moderate":0,"high":5,"critical":0,"total":5}
npm audit fix --force and the build broke. --force accepts major version changes in either direction; here it would have installed a linter configuration two major versions old. Undo it with git checkout package.json package-lock.json and npm ci.npm explain PACKAGE still tells you whether it is in what you ship.--omit=dev, one severity level) and honest. A check that fails every day for a linter's dependency is a check people learn to ignore.Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.