How to Install Node Versions and Upgrade or Downgrade Them by@zellwk

How to Install Node Versions and Upgrade or Downgrade Them

The easiest way to install Node is to download the LTS version. The Current version is the latest available version of NodeJS. You can upgrade and downgrade Node with a package manager. There are other package managers available and you can [choose] the one you like. To get the latest version of 16.xx.yy, you only need to provide the first number. The current version is good enough for most users, but be prepared to run into bugs if you use Current.
image
Zell Liew HackerNoon profile picture

Zell Liew

I'm a developer who creates content to make the web a better place. I write about HTML, CSS, JS, Node and other things.


The easiest way to install Node is to head over to NodeJS’s website and download the LTS version.


image

The LTS version is good enough for most users. I use LTS myself.


The current version is the latest available version. Developers will be making changes and creating libraries on this version. If you use Current, be prepared to run into bugs.


Once you downloaded and installed Node, you should be able to use the node command and the npm command. You can add -v to each of these commands to see their respective versions.


node -v
npm -v


image


Upgrading and Downgrading Node with a Package Manager

You want to have the flexibility to upgrade and downgrade Node easily if you’re going to work with Node.


The simplest way is to use npm (node default package manager), to install a package n. Let’s install a specific version of Node easily.


You can install n with the following command.


sudo npm install n -g


The -g flag here stands for global. It lets you use the n command everywhere.


Once you have installed n, you can use the following commands to install different versions of Node.


  • sudo n lts — installs the LTS version
  • sudo n latest — installs the latest version
  • sudo n install <num> — Installs a specific version on Node. Here, you only need to provide the first number. (To get the latest version of 16.xx.yy, you can simply write 16).


Node’s version numbers are written with a standard called Semver.


Using other package managers

You’re not limited to using n to upgrade or downgrade Node. There are other package managers available and you can choose the one you like.



Also published here.

react to story with heart
react to story with light
react to story with boat
react to story with money
Zell Liew HackerNoon profile picture
by Zell Liew @zellwk.I'm a developer who creates content to make the web a better place. I write about HTML, CSS, JS, Node and other things.
Read my stories
L O A D I N G
. . . comments & more!