npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

`npm update --latest`

I didn’t find a topic for this yet; it would often be useful to have a command to bump all dependencies to their latest version, similarly to what yarn upgrade --latest does. Has this been discussed before and possibly rejected? Sounds like a natural feature for npm to me.


I believe that npm update actually updates them according the semver constraints set in package.json, but I think just updating all of them to the latest version would rather break your code most of the time as it would easily update beyond breaking changes.


Yeah i definitely agree with you as a default. But I think that’s the reason to pass the --latest flag. Doing so means that the developer specifically is okay with all packages being updated and understands the risk of upgrading to versions that potentially will break things. Its definitely a rare case but there are times when this is especially wanted.


As Mark said.

I’d just say that bumping all dependencies to their latest versions (semver major, i.e., breaking changes) is very common for us, not rare. We do it regularly to stay up to date.


Does running npm install some-package@latest have the same effect? You can only update one package at once though.


+1 to this. When updating globally-installed modules, new major versions are ignored and I need to run npm -g install electron@latest typescript@latest … manually.

I was looking for an .npmrc field that forcefully overrides Semver, but I couldn’t find anything.

I’d be happy to submit a PR if I know this feature would be considered.


+1 as well.

I actually have a script that automatically bumps all package.json semver limits to ^<latest> before running update. This is what people do.