npm outdated Explained

What npm outdated does, with an example.

Published November 11, 2026

npm outdated compares the versions in your node_modules against the newest versions on the npm registry and prints a table of everything that has fallen behind. It never changes your project; it only reports, which makes it the safest first step before any upgrade.

How it works

Every dependency in package.json has a version range such as ^4.17.0. npm outdated reports three versions for each package: Current (what is installed), Wanted (the highest version your range allows) and Latest (the newest published version, even if it breaks your range).

If Wanted is higher than Current, a plain npm update will fix it. If Latest is higher than Wanted, the package has released a new major version, and upgrading means editing the range in package.json and testing for breaking changes.

The command exits with code 1 when something is outdated, so you can use it in CI to fail a build or print a reminder.

See it run

npm outdated
Package Current Wanted Latest Location
lodash 4.17.15 4.17.21 4.17.21 my-app
react 17.0.2 17.0.2 18.3.1 my-app
# Wanted == Current but Latest is higher → major upgrade needed
npm update lodash
changed 1 package in 2s
Typical output: lodash is behind within its range, react is a major version behind.

Practical examples

Check only top-level dependencies

By default npm outdated lists direct dependencies. Add --all to include nested ones, or --long to see the package type and homepage.

npm outdated --long
npm outdated --all

Machine-readable output for scripts

Use --json to feed the result into other tools, for example to open a ticket for each stale package.

npm outdated --json | jq 'keys'

Fail CI when dependencies are stale

Because the exit code is 1 when anything is outdated, a CI step can warn without extra scripting.

npm outdated || echo "Some dependencies are outdated — review before release"

Upgrade past your version range

To move to a new major version, install it explicitly; npm update alone will not cross the range.

npm install react@latest react-dom@latest

Common mistakes

  • Assuming npm outdated upgrades anything — it is read-only.
  • Running npm update and expecting a new major version; update respects the ^ and ~ ranges in package.json.
  • Ignoring the Wanted column: a package where Wanted is higher than Current is safe to update right now.
  • Upgrading every dependency at once instead of one major at a time, which makes breakages hard to trace.

Key takeaways

  • Current = installed, Wanted = highest version allowed by your range, Latest = newest published.
  • npm outdated only reports; npm update and npm install pkg@latest make changes.
  • A non-zero exit code makes it easy to use in CI.

FAQ

Why does npm outdated show nothing?

Everything installed is already at the newest version your ranges allow and the newest published version, or node_modules has not been installed yet. Run npm install first.

What is the difference between Wanted and Latest?

Wanted respects the semver range in package.json. Latest is simply the newest version on the registry, which may be a breaking major release outside your range.

Does it work with yarn or pnpm?

No, but they have equivalents: yarn outdated and pnpm outdated.

More JavaScript articles