Install or Upgrade to latest Node JS version in Ubuntu

Node Js

Node JS

We can install Node JS or upgrade currently installed version to latest version via two methods

  1. Installing latest .tar file and
  2. Node Version Manager (NVM)

Installing Node JS via .tar file

Download the latest version from https://nodejs.org/en/

At the time of writing this tutorial current version of node js is 8.11.3 LTS.

Now add it to environment variable bu running below command

Check the version of node js

Installing / upgrading Node Js via NVM

Other way to install / upgrade Node Js is via NVM (Node Version Manager) 

If it is not already installed on your machine, then follow below steps to install it, skip it already installed. You can also check these steps in the official documentation of NVM here

Run the script

Now source the profile to get the access in the current session which doesn’t require you logout and login back.

To see the list of versions available for installation run below command

To install a version that you need

Tell nvm to use currently installed version

Confirm the currently installed version by