Tutorial How To Install NVM on Eldernode Linux. Due to dependency issues and upgrades to Node.js versions, some applications still require older versions of Node.js. In this scenario you have to manage two or more applications that have different versions of Node.js. You may even need to upgrade or downgrade versions, and this is a source of problems. No need to worry. You can install several different versions of Node.js on one machine and run different programs on different versions of Node. Node version manager module written by Creationix. This script manages different active versions of Node.js to install programs with different versions of Node. You can visit the packages available in Eldernode if you need to buy Linux VPS server. Follow us with the tutorial How to Install NVM (Node Version Manager) on Eldernode Linux.
Tutorial How To Install NVM on Eldernode Linux
To install nvm you must have CURL or WGET installed on the machine. You can download the following auto-installation script to install NVM on Eldernode Linux using the command line tools:
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
or
# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
The above auto-install script clones the nvm repository to ~/.nvm in your home directory and adds the required source commands to your shell startup scripts i.e ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc, depending on the shell program you are using.
In the next step, you should verify if the nvm has been installed on your system:
# command -v nvm nvm
If you have successfully completed the installation process, you will see the nvm message in the output.
Use NVM on Linux
You can download the latest version of NVM using the following command. You can also use this command to update and install NVM:
# nvm install node
You can list the versions available in the node to install a specific “node” version and then install:
# nvm ls-remote # nvm install 10.15.3 #or 8.16.0, 11.15.0 etc
You can also check all installed version with the following command:
# nvm ls
Using the following command you can use a node.js version in any new shell:
# nvm use node #use default
or
# nvm use 10.15.3
Run a node version as shown below (to exit, press ^C):
# nvm use node #use default
or
# nvm use 10.15.3
Note: You can view the path to the executable to where a specific node version was installed as follows:
# nvm which 10.15.3 # nvm which 12.2.0 # nvm which system #check system-installed version of a node using “system” alias
To manually set a default node version to be used in any new shell, use the alias default:
# nvm alias default 10.15.3 # nvm alias default system # nvm alias default 12.2.0
Note: You can create a .nvmrc initialization file in your project root directory or any parent directory and add a node version number or any other flags or usage options that nvm understands, in it.
Conclusion
Node Version Manager is a tool that allows programmers to seamlessly switch between different versions of Node. In this article, we tried to teach you How To Install NVM on Eldernode Linux.