The Easiest way to Update or Downgrade Node.JS versions

Node.jsTerminal
February 20, 2023

More than often it’s necessary to downgrade or even upgrade Node.js when developing apps or just running some command line utilities.

I stumbled on one of the perhaps most pain-free ways to upgrade or even downgrade node.js.

We do this with the n package. And you can install it with:

sudo npm install n -g

Examples how to use it:

  • sudo n latest This will install the LTS (Long Term Supported) version.
  • sudo n lts This will install the LTS (Long Term Supported) version.
  • sudo n DESIREDVERSION Installs a specific Node version. You’ll just have to provide the version number. (To get the latest version of 17.xx.yy, you can write for example: sudo n 17

Before and after downgrading!