Updating NPM Packages Safely


Updated Jul 11th, 2022

Safely is important. One at a time, test, rollback if necessary. Read up on updates.

npm outdated
npm update

But “npm update” will not necessarily do the trick. Why? You may be restricted by the carets and tildes in the “package.json” file.

Carets and Tildes

Semver is Major.Minor.Patch and a tilde will only allow patch updates with tildes allowing minor updates.

You can update the “package.json” file manually, which is error prone and not recommended, or use a library.

npm install -g npm-check-updates

// then run

ncu -u

Global versus Local

This is a thing.

npm list -g