We have earlier discussed In this tutorial, we will learn about NVM & process to install NVM on Linux. NVM stands for Node version manager & as you might have guessed with name, it’s used to control Nodejs versions installed on our system. It is a command line utility, which allows us to use & switch between multiple versions of Nodejs.
It works on Linux & MacOS but does not yet support Windows machines, but there are some other 3rd party tools for Windows to do the same job.
Install NVM on Linux
The process to install NVM on Linux is simple & same whether you are using Ubuntu or CentOS/RHEL. Firstly we need to download the install script for NVM & run it. Download & execute the install script by running the following command from terminal,
$ curl -o https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
Once the script has been executed without any errors, we need to source our .bash_profile for immediately affect the changes made,
$ source ~/.bash_profile
Now we are ready to use NVM for installing the various versions of Node.JS on our systems. To check & list all the available Node.JS versions, run the following command from the terminal,
$ nvm list-remote
This would produce the list of all available versions of Node.JS & output will look something like this,
We can then choose a version & install it using NVM. Let’s suppose we need to install versions, v0.12.11 & v8.1.3, install them using the following command,
$ nvm install v0.12.11
$ nvm install v8.1.3
After installation, we can also set a default version which will start by default when we use Node.js. To set the default version, run the following command
$ nvm alias default v0.12.11
To switch to the different version, use the following command,
$ nvm use v8.1.3
To check the list of all installed Nodejs versions, use
$ nvm list
To remove an installed version of Nodejs, execute the following command,
$ nvm uninstall v8.1.3
With this, we end our tutorial on how to install NVM on Linux. Please feel free to send your questions & suggestions to us, using the comment box below.
If you think we have helped you or just want to support us, please consider these :-
Donate us some of your hard earned money:
Linux TechLab is thankful for your continued support.
Share this post:
This content was originally published here.