How to upgrade all node project dependencies to their latest version?

  • Post published:May 8, 2020

A package.json file is a JSON file containing information related to a project such us project dependencies, development dependencies, scripts, versions and other information. This file is contained in the root folder of any javascript/node project.

Before proceeding with this article, ensure that you have npm installed. Visit node.js to install npm.

To list packages with an outdated version, navigate to the package.json file and enter the following in a terminal or command:

npm outdated

To update the packages enter the following command:

npm update

Note that the above command will only update the packages to the latest minor version. A major version tends to introduce breaking changes, for example, when react-tables was upgraded from version 6 to 7.

In order to upgrade every npm package to the latest version (including latest major version), install the following package globally:

npm install -g npm-check-updates

To show any new version updates for the project, run the following command:


Whenever you need to upgrade a project, run the following command:

ncu -u

The above command will update all packages in the package.json file to the latest version, including major versions. Run the following command to complete the upgrade:

npm update

If the project dependencies where never installed, then run the below command instead of the update:

npm install


It is very easy to upgrade all packages in a package.json file thanks to npm and npm-check-updates. Follow these steps to upgrade all dependencies to their latest versions (including latest major versions):

  • ncu to list packages with outdated versions.
  • ncu -u to upgrade the packages to the latest versions in package.json file.
  • npm update or npm install to upgrade all packages.

Further information on npm-check-updates can be found at the following link:

Software versions used in this article

  • node v12.16.2
  • npm v6.14.4
  • ncu v4.1.2