Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npm update finishes without updating anything

Errornpm update prints nothing and package versions stay the same

Short answer

npm update only installs the highest version that still fits the range written in package.json. If you already have that version, it does nothing, even when a new major release exists. Run npm outdated to see wanted and latest, then use npm install pkg@latest to cross the range.

  • Applies to npm 10-11, Node.js 22, Node.js 24
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Compare the installed, wanted and latest versions of your packages.

    npm outdated
  2. 2Match what you see, then jump to its fix

    1. 1npm outdated shows Wanted equal to Current, but Latest is higherThe newest version is outside your semver rangeFix
    2. 2node_modules has the new version while package.json still shows the old rangeYou expect package.json to change, but update leaves the ranges aloneFix
    3. 3A package is stuck at a lower version than its range allows because a sub-dependency pins itAnother package holds the dependency backFix
    4. 4A command-line tool installed with -g is still oldYou updated the project, but the tool is a global packageFix

What does the error look like?

  • npm update prints nothing and package versions stay the same
  • package.json still shows the old range after npm update

Cause 1 of 4

The newest version is outside your semver range

1Check

npm update installs the latest version that satisfies the range, so a caret range stops at the next major (and a range such as ^0.2.0 stays inside 0.2.x).

npm outdated
npm view <package> version

2Fix

Install the new release on purpose with the latest tag. This changes package.json to match.

npm install <package>@latest

3Verify

npm outdated no longer lists the package.

npm outdated

Confirmed by docs.npmjs.com

Did this fix it?

Cause 2 of 4

You expect package.json to change, but update leaves the ranges alone

1Check

The save option defaults to false for npm update, so ranges in package.json are not rewritten.

git diff package.json package-lock.json

2Fix

Run update with --save to write the new ranges to package.json.

npm update --save

3Verify

package.json now shows the updated ranges.

git diff package.json

Confirmed by docs.npmjs.com

Did this fix it?

Cause 3 of 4

Another package holds the dependency back

1Check

npm update respects the semver constraints of your package and of its dependencies. If a dependency needs a tighter range, that range wins.

npm explain <package>

2Fix

Update the package that imposes the tight range, or ask its maintainers. Use an override only if you accept the risk.

npm install <parent-package>@latest

3Verify

npm explain shows the newer version in the chain.

npm explain <package>

Confirmed by docs.npmjs.com

Did this fix it?

Cause 4 of 4

You updated the project, but the tool is a global package

1Check

Global packages have no package.json range, so their wanted version is latest. They need the -g flag.

npm outdated -g

2Fix

Run the update with -g.

npm update -g

3Verify

The global tool reports the new version.

npm outdated -g

Confirmed by docs.npmjs.com

Did this fix it?

How do I stop it coming back?

  • Run npm outdated before an upgrade day, and read the Wanted and Latest columns.
  • Upgrade across major versions one package at a time, with tests.
  • Commit package-lock.json so everyone gets the same versions.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.