How to Install Node Version Manager on Ubuntu

Reading Time: 2 minutes

The Node Version Manager (NVM) is a command-line utility used to manage and switch between multiple active versions of Node.js on a single system. Whether you’re an admin or a developer, being able to change the javascript runtime environment on your system simplifies testing applications across different versions.

 

Step 1: Prerequisites

First, I will begin this process by logging into the server as the root user. Next, as best-practice dictates, we will ensure that all packages are up to date:

[root@host ~]# apt-get update -y

After this, we will ensure we have a C++ Compiler to work with, by installing the build-essential package:

[root@host ~]# apt-get install build-essential libssl-dev -y

Step 2: Install NVM

Run The Node Version Manager Installation Script

After getting our C++ Compiler installed, running this curl command will pull down and run the NVM installation script:

[root@host ~]# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Warning:
Always trust and verify the commands you are installing from an external bash source. Running a bash command from a malicious external source (especially as root) can cause undesirable effects up to and including data loss!

At the time of this publication, NVM v0.34.0 was the latest version available.
You can check for the newest release of NVM by visiting this link: https://github.com/nvm-sh/nvm/releases/latest. This link will always take you to the most recent release version of NVM. After this, you will want to adjust the above command to point to the newest version of NVM.

Once the installation process is complete, you should see output that looks something like this:

Close and then re-open your terminal to start using nvm

Instead of closing and re-opening your terminal, run the following command in the same terminal session:

[root@host ~]# source ~/.profile

or, you can log out and log back into your server if you wish.

Step 3: Verify the Installation

The last thing you will want to do is verify that NVM was installed and is working correctly. To accomplish this, run the following command:

[root@host ~]# nvm --version

The output will show:

[root@host ~]# 0.34.0

which is the latest version of NVM

For more information on how to use nvm, you can use the following command to get started:

[root@host ~]# nvm help

or visit NVM’s Github page for more info.

How can we help?

Our Support Teams are standing by with knowledgable admins with an intimate knowledge of these and other web hosting technologies, especially those discussed in this article. If you are uncomfortable walking through the steps outlined above, give us a call at 1.800.580.4985, or open a chat or ticket with us. If you’re running on one of our Fully managed servers, we will be happy to assist, directly implementing the changes in this article that you require.

Grade Us! https://www.grade.us/liquidweb/

Here's 75 % off, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support