We will be going over the steps that it will take to install Node using Node Version Manager (NVM) on Linux Ubuntu 18.04. Even though I am doing this on 18.04 it may work on future versions
Step 1 - Installing NVM
The easiest way to install NVM is by using a install script. Depending on what you have installed on your system you will be using either wget or curl. Copy and paste only one of the terminal commands below.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
If one of these commands do not work for you try the other one
Step 2 - Checking that NVM is installed
Now it is time to check to see if NVM is installed. Type the command below in your terminal.
nvm --version
If the version number is displayed then it is installed. If you did not get the version number, close the terminal and start a new one. Re-paste the command above and it should show you the version number.
Step 3 - Installing Node
There are several options to install node once NVM is installed.
To install the latest version of Node:
nvm install node
To install a specific version of Node:
nvm install 12.13.0 # or 10.10.0, 8.9.1, etc
Step 4 - Using NVM to Mange Node Versions
The first version of Node that is installed will be set as your default Node environment. In order to to change between the node versions you have installed use the command below:
nvm use 11.13.0 # or any other version you installed
Keep in mind your environment will change back to the default once you are done. In order to change the default use the command below.
nvm alias default 12.13.0 # or any other version you installed
Other Useful NVM Terminal Commands
How to list all installed Node environments:
nvm ls
How to list all Node Versions that can be installed.
nvm ls-remote
For more detailed information about NVM please visit https://github.com/nvm-sh/nvm
Comments