How to install specific / latest node.js version on Ubuntu

If you want to install node.js which is gaining popularity in recent days, you can follow below steps,

Installing latest node.js version

npm is the package manager for node.js JavaScript which we need to install in first,

 $ sudo apt-get install npm 
 $ sudo npm install n -g 
 $ sudo n latest 

Above command will install the latest version of Node.js,

Now, you can check which is the latest installed version as,

 $ node -v 

Also check which all node versions are supported and check all node versions as,

 $ n ls 

Changing to specific node version as you want.

Now, lets say if you have seen latest node version is 9.4.0 and want to install “6.8.1” version, use below command,

 $ sudo n 6.8.1 

Now, you can see version 6.8.1 is installed,

 $ node -v 

1 thought on “How to install specific / latest node.js version on Ubuntu”

Leave a Comment