How to install Node js on Ubuntu 19.04

Node.js on Ubuntu gives a way to write server-side scripting. It is an open-source Javascript cross-platform that executes the Javascript outside the browsers. It uses an NPM package manager to fetch different packages and modules for function extensions of the app developed on Node.js. To install Node.js and NPM on the latest Ubuntu 19.04, we don’t need to add any kind of PPA (personal package manager), however, there is an official PPA for Node.js that we can use to install the latest versions of Nodejs & NPM on Ubuntu such as 19.04, 18.04 LTS, 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) Linux servers.

As I said it is cross-platform so we can install it on macOS and Windows too. For NPM & Node.js Windows installation, see tutorial: Install npm and node.js packages on Windows 10/8/7

Install NPM & Node js on Ubuntu 19.04

Step 1: Offical PPA repository for Node.js

Open the command terminal on Ubuntu Linux and add the official repository for downloading and installing the NPM and Node.js. The Long term stable release of Node.js is 10.15.3 LTS and a current stable release is 11.14.0. By default, the user will get the long-term stable version 10.15.3 on Ubuntu 19.04, however, we can install the current version using Node.js PPA.

For the long term version, we don’t need to add the repo, just type the commands:

sudo apt-get install nodejs
Sudo apt-get install npm

Note: Without adding the latest PPA manually, the user will get Node.js LTS 10. x version from Ubuntu 19.04 repo. So to get a current 11.X release, add the below official repo.

For the latest Node.js version 11.x use this PPA:

sudo apt install curl
curl -sL | sudo -E bash -

For 10.X version Node.js use this repo.

sudo apt install curl
curl -sL | sudo -E bash -

Note: As we are using 11.x repo on Ubuntu 19.04, here.

Step 2: Update your system.

After adding the Node.js Repo run the system update command:

sudo apt-get update

Step 3: Command to install the Node.js on Ubuntu 19.04

Note: Without PPA we have to install Node and NPM using two different commands, however, those who are using the PPA will get both Nodejs and NPM using the single below command:

sudo apt-get install nodejs


Step 4 Install NPM on Ubuntu 190.4 via command

After installing the Node.js, use this command to set up the NPM package manager on Ubuntu 19.04

sudo apt-get install npm

Step 5: Check the installed Node and NPM version on Ubuntu

Versions on Ubuntu 19.04 without using PPA- LTS versions

To check the Node version on Ubuntu, the command is:

node --version

To check the NPM version, the command is:

npm -v 

check npm and node versions

After using the Latest Node.js PPA repo, the latest version–

latest version of NPM and Node on Ubutnu

Step 7: Command to upgrade NPM and Node (optional)

Note: If you are using the PPA, simply run sudo apt update

First, update npm,

sudo npm update
npm install -g [email protected]

Then update the node to the next version,

npm install -g [email protected]  
npm install -g [email protected]

Step 6: Command to select previous version npm on Ubuntu 19.04 (optional)

Note: Run these commands, if you know what are you doing otherwise it could mess up your NPm setup.

Command to see the older available version on Ubuntu

npm view npm versions --json

Command to select the previous NPM version

npm i -g [email protected]

For example, if I want to select the older 5.8.0 version then the command will be:

npm i -g [email protected]


sudo npm cache clean -f
sudo npm install -g n
sudo n 5.8.0

 Step 7: Let’s install something using NPM (options step):

For example, if we want to install Angular CLI using NPM then the commands will be like this:

For locally:

npm install @angular/cli

Fo Globally: -g syntax refers to the global

npm install -g @angular/cli

Step 8: Uninstall node js ubuntu

The command to uninstall node.js on Ubuntu is:

To uninstall Nodejs

sudo apt-get remove nodejs

To uninstall NPM

sudo apt-get remove npm

Completely remove NPM related entries:

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*



Other Tutorials:



Comments (4)

  1. Jeff Cliff April 22, 2019
    • H2S Media Team April 23, 2019
  2. john June 24, 2019
    • H2S Media Team June 24, 2019

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.