Node Version Manager (NVM) is a tool used to manage multiple active Node.js versions.
The Node.js platform, Node.js community of tools, and Node.js libraries are fast-moving targets – what might work under one Node.js version is not guaranteed to work for another version of Node.js. Hence, users need ways to switch between multiple versions of Node.js
NVM allows users to:
Run the NVM installer using either of the following commands:
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
Once NVM is installed it allows users to install any version of Node.js through a simple command:
nvm install <SPECIFIC_NODE_VERSION>
To install the latest version of Node.js, use the following command:
nvm install node
To use any specific version of Node.js for your code, use the following command:
nvm use <SPECIFIC_NODE_VERSION>