Reading Time: 3 minutes

What is Node.js?

Node.js_logo

Node.js is an open-source javascript runtime environment. It is memory efficient and is intentionally asynchronous. It is deployable on multiple platforms, including Windows, Mac OS X, and Linux, and is suited for rapid development. It’s event-driven architecture make it highly scalable and useful for intensive data-driven applications.

How to Install Node.js via NVM on Ubuntu 18.04

Preflight Check

  • These instructions are specifically intended for installing Node.js on Ubuntu 18.04 via the Node Version Manager or NVM.
  • These instructions were performed on a system that already had NVM installed. If you’re looking for instructions on getting NVM installed, head over to our article, How to Install Node Version Manager on Ubuntu.
  • This tutorial was performed on a Liquid Web Self Managed Ubuntu 18.04 LTS server as the root user.

List Available Node.js Versions

In order to view all of the Node.js versions available to be installed via NVM, run the following command:

root@ubuntu:~# nvm ls-remote
       v12.13.0   (LTS: Erbium)
       v12.13.1   (LTS: Erbium)
       v12.14.0   (LTS: Erbium)
       v12.14.1   (LTS: Erbium)
       v12.15.0   (LTS: Erbium)
       v12.16.0   (LTS: Erbium)
       v12.16.1   (LTS: Erbium)
       v12.16.2   (LTS: Erbium)
       v12.16.3   (Latest LTS: Erbium)
        v13.0.0
        v13.0.1
        v13.1.0
        v13.2.0
        v13.3.0
        v13.4.0
        v13.5.0
        v13.6.0
        v13.7.0
        v13.8.0
        v13.9.0
       v13.10.0
       v13.10.1
       v13.11.0
       v13.12.0
       v13.13.0
       v13.14.0
        v14.0.0
        v14.1.0
        v14.2.0

The output will be a long list of version numbers. At the time of writing this article, there were 549 different Node.js version available to install via NVM. We have only listed the last three major versions including the Latest LTS: Erbium (LTS stands for Long Term Support).

Install Node.js

Next, install the latest version of Node.js from the v13 release by running the nvm install 13 command. The output should look something like this.

root@host:~# nvm install 13
Downloading and installing node v13.14.0...
Downloading https://nodejs.org/dist/v13.14.0/node-v13.14.0-linux-x64.tar.xz...
################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v13.14.0 (npm v6.14.4)
Creating default alias: default -> 13 (-> v13.14.0)
root@host:~#

In order to review which version of Node.js is currently active, run this command.

root@ubuntu:~# nvm current
v13.14.0

Switch Between Node.js versions with NVM

NVM allows the user to manage multiple versions of Node.js. For example, in order to install the latest stable version of NVM, we will run the following command.

root@host:~# nvm install stable
Downloading and installing node v14.2.0...
Downloading https://nodejs.org/dist/v14.2.0/node-v14.2.0-linux-x64.tar.xz...
######################################################################100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v14.2.0 (npm v6.14.4)
root@host:~#

Installing a new version of Node.js automatically switches from the currently active version to the new updated version. Observe the output of the nvm current command now.

root@ubuntu:~# nvm current
v14.2.0

Now that there are two versions of Node.js available. To use v13, we will run the following command to switch back to v13

root@host:~# nvm use v13
Now using node v13.14.0 (npm v6.14.4)
root@host:~#

NVM makes installing and managing different versions of Node.js a snap. Now that Node.js is installed, your server environment is primed and ready to begin developing your Node.js application!

Would you like more information about setting up an advanced, stable development environment? Simply give us a call today at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Solutions Team or an experienced Hosting Advisors! We will provide you with reliable information from which you can make an informed decision.

Avatar for Justin Palmer

About the Author: Justin Palmer

Justin Palmer is a professional application developer with Liquid Web

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article