npm outdate and
npm update to check for and update to newer versions of your installed node modules using npm's built-in commands.
Currentis what you have installed
Wantedis the latest version that satisfies the semver range in package.json
Latestis, you guessed it, the latest.
Red items mean the wanted version is also the latest.
This will update all packages to the
My package.json has
"react": "^16.13.1" listed as a dependency.
npm update would change this to
"react": "^16.14.0",, not v17.
npm outdated again would show I have every package updated the wanted version.
Individual packages can be updated by listing the package names in the command e.g.
npm update react react-dom
Updating to the latest and greatest
npm update only gets you as far as your semver range. If you want to break above that and get the latest, append
@latest to the package name. e.g.
npm install react@latest
Update Globally Installed Packages
All three commands work globally with the addition of
npm outdated -g
npm update -g
npm install -g package@latest