npm outdated. It lists each package's current, wanted (highest allowed by your package.json range) and latest (newest published) versions.Guide
Packages release new versions constantly. Here's how to update them safely and check them for security issues.
Before changing anything, get the lay of the land. npm outdated lists every package
that has a newer version available, in a three-column table worth understanding:
package.json range (the caret rules from the versioning chapter).See which packages are behind
$ npm outdated Ctrl+`)npm outdatedIf a package's Wanted matches Latest, a simple npm update gets you there. If Latest is higher, that's a major bump needing care (below).
npm update moves packages up to the "Wanted" version — that is, as far as your
package.json ranges safely allow (new minors and patches, never a new
major). This is the routine, low-risk update you can do regularly.
Apply the safe updates
$ npm update
$ npm run build # always re-check the build afterwards npm update in the terminalnpm update respects the caret ranges, so it won't jump a package across a major version. That's why it's safe to run often.
When npm outdated shows a "Latest" that's a higher major number (say you're on
6.x and 7.0.0 exists), npm update won't take you there on
purpose — a major version can include breaking changes. To move up deliberately:
Bump one package to its latest major
$ npm install astro@latest
$ # or a specific version:
$ npm install astro@7.0.0 npm run build and test thoroughly before committingDo majors one package at a time and test between each, so if something breaks you know exactly which update caused it.
Packages occasionally turn out to have security vulnerabilities. npm audit compares
everything you've installed against a public database of known issues and reports any matches,
with a severity rating.
Scan for known vulnerabilities
$ npm audit
$ npm audit fix npm audit to see the reportnpm audit fix to let npm upgrade to safe versions automatically where it cannpm run build to confirm the fixes didn't break anythingnpm audit fix only applies changes allowed by your version ranges. It may suggest 'npm audit fix --force' for breaking fixes — treat that like a major bump and test carefully.
Don't panic at audit warnings. Many reported issues are in deep build-time tools and never affect your shipped site. Read the severity and what the package is used for before forcing a risky fix. After any update, the habit that keeps you safe is simple: npm run build and test.
Up next: when something goes wrong — the reliable fixes for npm's most common errors.
FAQ
npm outdated. It lists each package's current, wanted (highest allowed by your package.json range) and latest (newest published) versions.npm update only moves packages up within the range in package.json (e.g. ^4.3.0 stays on 4.x). A new major version needs a deliberate bump and testing.npm audit fix upgrades to safe versions automatically where it can.npm run build (and your tests) to confirm nothing broke before committing the changed package.json / package-lock.json.