Keeping your npm packages up-to-date is crucial for maintaining the security and performance of your projects. In this guide, I'll walk you through the steps to identify and update outdated npm packages.
The npm outdated
command checks the registry for outdated installed packages. It shows direct dependencies by default, but with the --all
flag, it includes all outdated meta-dependencies. Key output fields include wanted
(maximum version satisfying semver in package.json
), latest
(latest version in the registry), location
, and depended by
. Red indicates a newer version matches semver requirements, and yellow indicates a newer version above semver requirements. Various flags like --json
, --long
, and --global
modify the output format and scope.
For more details, visit npm outdated documentation.
Note that by default npm update
will not update the semver
values of direct dependencies in your project package.json. If you want to also update values in package.json
you can run: npm update --save
(or add the save=true
option to a configuration file to make that the default behavior).
For more details, visit npm update documentation
Top comments (0)