How to show latest package version in NPM

NodeJS’s package manager NPM has a handy feature for listing outdated packages and updating selected packages to the latest version. The MailSlurp web app is built with NodeJS and Vue. We use the NPM outdated command to keep our packages up to date. Here is how.

Showing outdated packages

To see the old packages in a NodeJS project navigate to the project directory and run npm outdated. You will see a list of outdated packages and the latest version published to NPM.

$ npm outdated
Package                         Current          Wanted   Latest  Location                              Depended by
@types/debug                      4.1.6           4.1.7    4.1.7  node_modules/@types/debug             mailslurp-app
@types/node-fetch                2.5.11          2.5.12   2.5.12  node_modules/@types/node-fetch        mailslurp-app
@types/quoted-printable           0.2.2           0.2.2    1.0.0  node_modules/@types/quoted-printable  mailslurp-app
@types/utf8                       2.1.6           2.1.6    3.0.0  node_modules/@types/utf8              mailslurp-app
babel-core               7.0.0-bridge.0  7.0.0-bridge.0   6.26.3  node_modules/babel-core               mailslurp-app
babel-jest                       26.6.3          26.6.3   27.0.6  node_modules/babel-jest               mailslurp-app
bootstrap                         4.6.0           4.6.0    5.0.2  node_modules/bootstrap                mailslurp-app
chromedriver                     87.0.7          87.0.7   92.0.0  node_modules/chromedriver             mailslurp-app
date-fns                         2.22.1          2.23.0   2.23.0  node_modules/date-fns                 mailslurp-app
expect-playwright                 0.3.4           0.3.4    0.7.2  node_modules/expect-playwright        mailslurp-app
fsevents                        MISSING           2.3.2    2.3.2  -                                     mailslurp-app
jest                             26.6.3          26.6.3   27.0.6  node_modules/jest                     mailslurp-app
jest-circus                      26.6.3          26.6.3   27.0.6  node_modules/jest-circus              mailslurp-app
jest-runner                      26.6.3          26.6.3   27.0.6  node_modules/jest-runner              mailslurp-app
nuxt-social-meta                  0.0.5           0.0.5    1.0.0  node_modules/nuxt-social-meta         mailslurp-app
nuxt-stripe-module                2.2.0           2.2.0    3.2.0  node_modules/nuxt-stripe-module       mailslurp-app
playwright-chromium              1.12.3          1.13.0   1.13.0  node_modules/playwright-chromium      mailslurp-app
sass-loader                      10.2.0          10.2.0   12.1.0  node_modules/sass-loader              mailslurp-app
start-server-and-test            1.12.6          1.13.0   1.13.0  node_modules/start-server-and-test    mailslurp-app
stripe                          8.164.0         8.165.0  8.165.0  node_modules/stripe                   mailslurp-app
supports-color                    8.1.1           8.1.1    9.0.2  node_modules/supports-color           mailslurp-app
ts-jest                          26.5.6          26.5.6   27.0.4  node_modules/ts-jest                  mailslurp-app
ts-loader                         8.3.0           8.3.0    9.2.4  node_modules/ts-loader                mailslurp-app

Upgrading a dependency

To upgrade a dependency run npm update <package>:

$ npm update playwright-chromium
[                  ] | reify:playwright-chromium: http fetch GET 200 https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.13.0.tgz 388ms (cache miss)

changed 1 package, and audited 3121 packages in 53s

You will see that the package.json and lockfile are updated to the latest version.