In general, NVM helps you to switch between different versions of Node. This blog covers all the relevant details about the Node Version Manager(NVM). So let’s start with the Nodejs first:
Nodejs releases their updates at a regular interval of time. Every new major release of Nodejs comes out every six months. The official Nodejs foundation is very keen on releasing its updated versions.
The latest version of Nodejs is Node.13.0.1 released in 2019 and still continues.
Whenever the Node team releases a new odd version, it’s previous even version will become Long Term Support (LTS). This Long Term Support (LTS) comes with 18 months of active support from the date of implementation of LTS.
After six months, the odd-numbered releases will become unsupported. After then the even-numbered releases move to Active LTS status. And such Active LTS will be ready for general use. LTS release status is “long-term support”, which guarantees to fix bugs for 30 months in total. Production applications should only use Active LTS releases.
To manage different versions of Nodejs, a special tool called Node Version Manager(NVM) is implemented.
NODE VERSION MANAGER(NVM)
Node Version Manager(NVM) is a powerful tool for the programmers to switch between different Node versions. It is an added advantage for one who works in multiple projects of Nodejs that having various versions. It allows you to install each version with a single command. Then, as usual, it allows you to set a default via the command-line interface.
BENEFITS OF NVM INSTALL
- Easy to download and deploy in any Nodejs projects.
- To manage different Nodejs versions, it is provided with Command-line utility.
- Developers can access all the long term support (LTS) versions of Nodejs.
- It handles compilation for most systems with no-prebuilt binaries available.
- And also it simplifies the installation process.
INSTALL Node version manager
By using the following command to install NVM on your system/machine,
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
Some useful commands of Node version manager:
Check NVM version
code source nvm --version Check all Nodejs versions installed on your machine Code source nvm ls
Install a particular version of Nodejs
nvm install NODE_VERSION_NAME //Replace NODE_VERSION_NAME to actual nodejs version
Use a particular version of Nodejs
nvm use NODE_VERSION_NAME //Replace NODE_VERSION_NAME to actual nodejs version
Set default version of Nodejs
nvm alias default NODE_VERSION_NAME //Replace NODE_VERSION_NAME to actual nodejs version
Node Version Manager(NVM) allows you to use aliases to target versions. You can do this with a specific version number only. These aliases include:
- node: which installs the latest version of Nodejs
- unstable: installs the latest unstable version of Nodejs
- iojs: installs the latest stable version of io.js
Read: Nodejs – OS module
Create new alias of Nodejs
nvm alias ALIAS NAME NODE_VERSION_NAME //Replace //Node_Version_Name to actual nodejs version //ALIAS_NAME to actual alias name
Knowing what is Node Version Manager(NVM) and how to use it will greatly help you to save more time. Keep this blog for your future reference and if you ever need a refresher.
Still, need clarification about the Nodejs and its developmental process? Contact us without any hesitation.