Select Page

Today I am going to show How to install Nodejs on your ubuntu machine of any version, you can install multiple versions of nodejs at same time using nvm.

NVM – Node Version Manager

nvm is to node what rbenv is to ruby, nvm helps us to use multiple versions of node on project level and over all system wide level, We will be using nvm to install because ubuntu does not have latest version of node. This is the easiest method of all and to stay updated on latest release of node, lets install nvm

Now we need to source the nvm directory and nvm.sh to the shell, Add below lines to your ~/.bashrc, ~/.profile, or ~/.zshrc based on the shell you use, so that the command will be available on you login

Now get the list of available versions of nodejs

Based on your requirement, install the node version i will go for LTS version

Set this version as default

Now Nodejs is installed

You also have access to npm (Node Package Manager) you can get many node packages with single command lets check its version

Now suppose any of your project depends on older version of node then run this in specific project directory