If you are a JavaScript enthusiast you may be interested in installing Node.js, which is a JavaScript runtime environment that executes JavaScript code outside of a web browser. This guide will describe a procedure of installing Node.js and the NVM on Ubuntu 20.04 LTS Focal Fossa.

In this tutorial you will learn:
  • How to install default Node.js
  • How to check Node.js version
  • How to install NVM from source
  • How to any Node.js version per user basis
Installation of Node.js and NVM on Ubuntu 20.04 LTS Focal Fossa
Installation of Node.js and NVM on Ubuntu 20.04 LTS Focal Fossa

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software NVM, Node.js
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Install Node.js on Ubuntu 20.04 LTS Focal Fossa step by step instructions

Install stable Node.js from Ubuntu respository

The recommended way to install Node.js on your Ubuntu 20.04 LTS Focal Fossa is by using the apt command to install the stable default Node.js version from the standard Ubuntu repository:
$ sudo apt install nodejs
Once installed, check the Node.js version:
$ node --version

Subscribe to our NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.

Install any Node.js version from source

Take the following steps to install any Node.js version on your Ubuntu 20.04 system per user basis.

  1. As a regular user first the install NVM manager:
    $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
  2. Update your shell environment:
    $ source ~/.profile
  3. Check the NVM availablity by checking for its version:
    $ nvm --version

  4. Next, list all available Node.js versions:
    $ nvm ls-remote
           v12.13.0   (LTS: Erbium)
           v12.13.1   (Latest LTS: Erbium)
    ->      v13.2.0
  5. Select and take a note of the Node.js version number your wish to install. Once ready execute the following command to install any desired version. For example:
    $ nvm install 13.2.0
  6. Check for installed Node.js version:
    $ node -v
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.