Byline:

Find newer versions of package dependencies than what your package.json allows

Key links

Aggressively upgrade packages.

npm-check-updates upgrades your package.json dependencies to the latest versions, ignoring specified versions.

  • maintains existing semantic versioning policies, i.e. "express": "^4.0.0" to "express": "^5.0.0".
  • only modifies package.json file. Run npm install to update your installed packages and package-lock.json.

It will not install packages.

It will not update your lockfile.

Installation

$ npm install -g npm-check-updates@latest

Usage

With npx.

$ npx npm-check-updates

If installed globally:

$ ncu

Check:

$ ncu
Checking package.json
[====================] 5/5 100%

 express           4.12.x  →   4.13.x
 multer            ^0.1.8  →   ^1.0.1
 react-bootstrap  ^0.22.6  →  ^0.24.0
 react-a11y        ^0.1.1  →   ^0.2.6
 webpack          ~1.9.10  →  ~1.10.5

Upgrade:

$ ncu -u

In CI

The default is level 1 and that is to exit with error status on an actual error.

Use error level 2 to exit with success on nothing to update - which is how npm update operates with no flags.

if ncu -e 2; then
  echo 'Nothing to update'
  exit 0
fi

echo 'Upgrading'
ncu -u

npm install