npm update Explained

What npm update does, with an example.

Published November 11, 2026

npm update upgrades installed packages to the newest versions allowed by the ranges in package.json (such as ^1.2.0) and updates package-lock.json.

How it works

It does not cross major versions. For those, install the new range explicitly, for example npm install react@latest.

Use npm outdated first to see what is available.

Try it

npm outdated
Package Current Wanted Latest
npm update
changed 4 packages

Practical examples

Update all

npm update

One package

npm update lodash

Cross a major

npm install react@latest

Review first

npm outdated

Common mistakes

  • Expecting a major upgrade from npm update.
  • Updating everything before releases without tests.
  • Not committing the lockfile.

Key takeaways

  • npm update upgrades installed packages to the newest versions allowed by the ranges in package.json (such as ^1.2.0) and updates package-lock.json.
  • Run npm help <command> for every option.
  • Commit package-lock.json.

FAQ

Why didn't it upgrade?

The new version is outside your semver range.

Does this work with yarn or pnpm?

They have equivalents with similar commands.

More JavaScript articles