noirsociety
noirsociety

Reputation: 374

Why "npm update" will update the module(s) but not its SemVer in package.json?

  1. In "package.json," I clearly have an outdated express module version --> "4.10.0"

enter image description here

  1. "npm outdated" is recommending an update to "4.17.1"

enter image description here

  1. although "npm update" updated the express module to "4.17.1", "package.json" remains "4.10.0"

enter image description here

My question is: how do I update both the module(s) and "package.json" simultaneously?

Upvotes: 1

Views: 62

Answers (2)

Matt
Matt

Reputation: 74670

If you have a package to update you can install a specific version with npm (instead of update)

npm install --save-exact [email protected]

Yarn also supports this for add/upgrade without the extra option.

yarn upgrade [email protected]

It's unwieldy for large updates though, see Raphael's answer

Upvotes: 1

Raphael PICCOLO
Raphael PICCOLO

Reputation: 2175

Consider using npm-check-updates.

At first I didn't want to install something for this basic task but npm lacks this "basic" option

Upvotes: 1

Related Questions