Prerequisites
Step 1 – Installing NVM
This will create a .nvm directory under the logged in user home directory. NVM keeps all the binaries and configuration files under this .nvm directory. Logout and login with your user account to load nvm environment or use the following command to load environment without login again. At this stage, you have successfully install NVM on your system.
Step 2 – Installing Node using NVM
NVM allowed users to install multiple node.js versions for each user account. First of all, use the following command to find all available versions of node.js for installation: Above command will show you a list of available node versions. Now you can install any node version by typing: Just change 12.19.0 with your required version like 11.15.0, 10.11.0, etc. It also provided alias for the latest stable node version, LTS version and other previous LTS version. You can also use lts/dubnium, lts/carbon etc.
Step 3 – Working with NVM
You can use the following command to list installed versions of node for the current user. With this command, you can find the available node.js version for the installation. You can also select a different version for the current session. The selected version will be the currently active version for the current shell only. To find the default Node version set for the current user, type: When you have multiple node.js version installed, You can choose specific version to run any script:
Step 4 – Uninstall Specific Node Version with NVM
You can remove any unused version by running the following command. Just make sure the version you are removing is not currently active version. To remove Node.js 10.12.0, type: