Update NPM packages to the latest version

If you want to update all of your application's packages to their latest version, you first need to identify the packages that are out of date. To do this, run the following command to discover any out-of-date packages:

npm outdated

It displays a list like this:

The "Wanted" column displays the latest safe version you can upgrade to and the "Latest" column displays the latest version available in the npm registry.

If you want to just update your dependencies to the latest safe version, use this command:

npm update

However, if you want to update to the latest major version, which might have breaking changes too, use the following command:

npm install <package1>@latest <package2>@latest <package3>@latest

If you want to update all the dependencies in one command, use the following tools:

npx npm-check-updates -u
npm install