npm update finishes without updating anything
npm update prints nothing and package versions stay the sameShort 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.
Fix it fast
1Find out which cause you have
Compare the installed, wanted and latest versions of your packages.
npm outdated2Match what you see, then jump to its fix
- 1
npm outdated shows Wanted equal to Current, but Latest is higherThe newest version is outside your semver rangeFix - 2
node_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
A package is stuck at a lower version than its range allows because a sub-dependency pins itAnother package holds the dependency backFix - 4
A command-line tool installed with -g is still oldYou updated the project, but the tool is a global packageFix
- 1
What does the error look like?
npm update prints nothing and package versions stay the samepackage.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> version2Fix
Install the new release on purpose with the latest tag. This changes package.json to match.
npm install <package>@latest3Verify
npm outdated no longer lists the package.
npm outdatedConfirmed by docs.npmjs.com
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.json2Fix
Run update with --save to write the new ranges to package.json.
npm update --save3Verify
package.json now shows the updated ranges.
git diff package.jsonConfirmed by docs.npmjs.com
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>@latest3Verify
npm explain shows the newer version in the chain.
npm explain <package>Confirmed by docs.npmjs.com
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 -g2Fix
Run the update with -g.
npm update -g3Verify
The global tool reports the new version.
npm outdated -gConfirmed by docs.npmjs.com
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 fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack 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 fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix