Update Node.js with NVM

There are different way of updating the Node.js, but the best way of updating Node.js on Ubundu server is to use NVM (Node Version Manager).

First update the package repository with the command:

sudo apt update

Now install NVM using curl command.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

In order to verify the nvm version, close and reopen the terminal or run following command

source ~/.bashrc

Verify if you have successfully installed NVM:

nvm --version

In order to list the available releases run following command:

nvm ls-remote

To install the latest version, use the nvm command with the specific Node.js version:

nvm install [version number]
Installing node 14
Installing node 15

Since now we have installed two different versions of node 14 & 15, there is a nvm command that can be used to switch in between node versions.

node use 15
using node 15

That’s it, this is how you can manage and update multiple node versions, by the way same can be done on Mac IOS.

Author: Danyal
I'm skilled programmer with expertise in Vue.js/Nux.js for front-end development and PHP Laravel for back-end development. I excel in building APIs and services, and also have experience in web server setup & maintenance. My versatile skill set allows you to develop and maintain web applications effectively, from the user interface to the server-side functionality. I love coding with never ending learning attitude, thanks for visiting danya.dk