How to Check and Update Outdated NPM Packages

Beda Arta
NPMNode.js

A quick guide on how I check and update outdated NPM packages in a Node.js project using simple npm commands to keep dependencies up to date.

  1. Check the outdated npm packages in the current project by running this command:
npm outdated

Below are some examples of outdated npm packages that need to be updated in my project.

Package Current Wanted Latest Location Depended by
@azure/data-tables 13.3.1 13.3.2 13.3.2 node_modules/@azure/data-tables migrations
contentful-import 9.4.111 9.4.129 9.4.129 node_modules/contentful-import migrations
contentful-management 11.54.4 11.63.1 11.63.1 node_modules/contentful-management migrations
contentful-migration 4.31.0 4.31.5 4.31.5 node_modules/contentful-migration migrations
dotenv 16.6.1 16.6.1 17.2.3 node_modules/dotenv migrations
jest 29.7.0 29.7.0 30.2.0 node_modules/jest migrations
rimraf 3.0.2 3.0.2 6.1.2 node_modules/rimraf migrations
typescript 5.9.2 5.9.3 5.9.3 node_modules/typescript migrations
  1. To update the npm packages, simply run this command:
npm update

This will update packages to the wanted version.

  1. Once updated, check one more time to see the changes by re-running this command:
npm outdated
Package Current Wanted Latest Location Depended by
dotenv 16.6.1 16.6.1 17.2.3 node_modules/dotenv migrations
jest 29.7.0 29.7.0 30.2.0 node_modules/jest migrations
rimraf 3.0.2 3.0.2 6.1.2 node_modules/rimraf migrations

After updating the packages, the next step I usually take is to re-test the project to ensure everything works as expected.

For some projects I worked on earlier, I used npm-check-updates as an alternative approach.