inspect
npm outdated
Compares installed versions against the registry and reports which packages have a newer version available in current/wanted/latest columns. `wanted` respects your semver range, `latest` is the newest published.
npm outdated [<pkg>...] [--long] [--global] Common flags
| Flag | Purpose |
|---|---|
| --long (-l) | Show extra columns including package type |
| --json | Emit machine-readable JSON |
| --global (-g) | Check globally-installed packages |
| --all | Include nested dependencies, not just top-level |
Examples
npm outdated Show all top-level packages with newer versions available
npm outdated --long Include type (dependencies/devDependencies) column
npm outdated -g --depth=0 Check outdated global packages
Gotcha
`wanted` is what `npm update` would install; `latest` may be a major bump you must accept manually with `npm install pkg@latest`. Exits with code 1 when anything is outdated — keep that in mind for CI.
Related commands
npm update
Updates packages to the newest version that still satisfies the semver range in package.json and refreshes package-lock.json. Without arguments, it tries every listed dependency.
npm view (info)
Fetches package metadata straight from the registry — versions, maintainers, dist-tags, dependencies, and more. Aliases: `info`, `show`, `v`.
npm list
Prints the installed dependency tree of the current project (or globally). Aliases: `ls`, `la`, `ll`.
npm why (explain)
Prints the dependency chain(s) that caused a specific package (or version) to be installed. Alias: `why`; invaluable for tracking down duplicate copies or unexpected transitive deps.