How to Update Node.js + NPM + Express All to Latest Versions

Tadashi Shigeoka ·  Thu, October 10, 2019

I’ll introduce how to update Node.js, npm, and Express all to their latest versions.

Express | Node.js

Prerequisites

This article is based on the following GitHub Pull Request. Please check the Pull Request directly for the overall changes.

Update Node.js version to v10.16.3 & npm update · Pull Request #2 · codenote-net/expressjs-sandbox

Node.js, Express version

  • Node.js version 8.11.1 -> 10.16.3
  • Express version 4.16.0 -> 4.17.1

npm version

For npm versions, please refer to the following commit. Since most were npm installed during initial Express project creation, I don’t think there are any special npm packages.

npm update [2019-10-07] · Pull Request #2 · codenote-net/expressjs-sandbox

Update Node.js & NPM Version Steps

Install Latest Node.js LTS Version

$ nvm install --lts
Installing latest LTS version.
v10.16.3 is already installed.
Now using node v10.16.3 (npm v6.9.0)

Also change the version in the .node-version file if it exists.

diff --git a/.node-version b/.node-version
index d3a8b24..70047db 100644
--- a/.node-version
+++ b/.node-version
@@ -1 +1 @@
-v8.11.1
+v10.16.3

Update Node.js version to v10.16.3 & npm update · Pull Request #2 · codenote-net/expressjs-sandbox

Install npm-check-updates

$ npm install -g npm-check-updates

npm update with npm-check-updates --upgrade

npm-check-updates --upgrade
npm install

This will create many diffs in package.json, but just run npm install without question and run automated tests or perform functional testing.

Update Node.js version to v10.16.3 & npm update · Pull Request #2 · codenote-net/expressjs-sandbox

That’s all from the Gemba.