How to Install Latest Node.js and NPM on Ubuntu
Posted by igor on August 27 2019 09:01:22
Node.js is a Chrome’s JavaScript runtime derivative platform for network applications. To install latest Node.js on Ubuntu 19.04, 18.04 LTS, 16.04 LTS and 14.04 LTS just use official PPA

Step 1 - check/install curl


curl is needed for download operations. By default it isn't installed. Type in terminal:


$ curl


If command not found, install it:


$ sudo apt install curl



Step 2 - Adding Node.js repo



There are LTS and latest releases of Node.js package. Select version you need and add according repository using following commands.

For latest release:


$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt-get update


For LTS release:


$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get update


Step 3 - Installing Node.js



Once Node.js repo has been added and package database has been updated, it's time to install the package. Command below will also install NMP:


$ sudo apt-get install nodejs



Step 4 - Installation check (optional)



To verify Node.js installation, run command:


$ node -v

v12.8.0


The same for NMP:


$ npm -v

6.10.2


So, you are ready for coding! Detals about Node.js are on official website.