Node.js is an extremely vast, server-side open-source JavaScript environment that runs on Chrome’s V8 JS engine. This enormousness of Node.js has resulted in a huge and active community of users, flooding contributions every second.
Although, not exactly to the point, this makes some sense as to why it is quite important to keep updating our version of Node.js.
Well, that’s not all. It is eminent for technologies like this, to stay up to date by enhancing security and introducing better features considering the increasing threats and changing demands out there.
You must have come across Node.js through the MEAN or MERN stack or any other JavaScript framework. It becomes important for a Node.js developer to keep Node.js updated for system security reasons as well.
In this tutorial, I am going to walk you through various ways of updating Node.js on MacOS, Windows and Linux.
Before we begin, let’s start by checking our version of Node.js, like this:
OR
Different Ways to Update NodeJS on MacOS
1. npm
NPM is an online open source repository for publishing Node.js projects. It is also a command-line utility for interacting with those repositories and helps in package installations.
If you are a MacOS user, this simple update method with npm, is relevant for you.
To update Node.js via command line we can make use of the n model in npm command. This will help us interact with different versions of Node.
Let us first clear any cache that’s present:
Installing n globally:
Now that we have n installed, let’s install the latest stable version of Node:
You may even choose to install the latest features by:
To download a specific version, you can simply do this:
2. Homebrew
Homebrew is made for MacOS and is a popular package management tool.
Let us use it for installing Node.js on our Mac machine.
Start by running this command in our MacOS terminal:
Update Homebrew before updating Node, run:
Update node:
To easily switch between Node.js versions:
How to Update NodeJS on Windows
1. nvm-windows
On Windows, we can make use of the nvm-windows, Node Version Manager (nvm) tool. Although there are several usage similarities, NVM and nvm-windows aren’t the same.
It is required that you uninstall any existing Node and npm versions, otherwise there’s a chance for versions to conflict. Make sure you also delete any existing installation directories for example (%ProgramFiles%\nodejs)
Click here to download the nvm-setup.zip file and run the latest installer.
Now, jump to your Command Prompt or PowerShell terminal. Remember to Run it as Administrator because the utility runs in an Admin shell.
Start by installing the LTS (long-term supported) version, let’s say we want to install 14.17.1:
Next, switch to the version you just installed:
Or, you can choose to simply install whatever is the latest version:
To view a list of installed Node.js versions, run this:
To view a list of versions available for download, run this:
Different Ways to Update NodeJS on Linux (or macOS)
1. Node Version Manager
A Node version manager is tool or a utility so to say, that enables developers to install different versions of Node.js and switch impeccably between them.
There are two Node version managers to choose from for Linux or MacOS, nvm or n.
nvm
nvm is nothing but a script-based version manager of Node.js. You can update your version of Node.js on Linux or MacOS with Wget or cURL.
Let’s say we want to install the 38.0 version of nvm, in this this example.
To update with Wget, run this command:
To update with cURL, run this command:
These commands will also let you clone the repo to ~/.nvm in a way to let you make changes to your bash profile and giving you to access to nvm globally around your system.
Let us check if installation was successful:
If installed properly, it will spit out nvm.
n
We have already seen how we can upgrade Node.js on MacOS with n. These steps that follow are for Linux.
Let us first clear any cache that’s present:
Installing n globally:
Now that we have n installed, let’s install the latest stable version of Node:
You may even choose to install the latest features by:
To download a specific version, you can simply do this:
To see a list of downloaded versions on your machine:
To upgrade to the latest LTS version:
Updating NodeJS using a Node Installer
Although this is the least recommended way to perform a version update for Node.js, it is still a possible solution if for some reason you face issues with any steps above.

Updating Node.js with Installer on Linux
Simply jump to the official downloads website where you will find many Linux binary packages. Select your preferred installer.
Updating Node.js with Installer on Windows & MacOS
Based on your system, you can select from any of the two highlighted installers for Windows and MacOS.
Run the installation wizard. Normally, there’s nothing of the defaults that you would have to change. You can choose to not install Chocolatey.
After you’re done, it will have flawlessly completed installing Node.js and upgrading your version of Node.js by replacing it with the new one.