Node Version Manager (NVM)

Here's a step-by-step guide on how to use NVM (Node Version Manager) to install and manage specific versions of Node.js on your system:
Install NVM
If you haven't already installed NVM, you can do so by running the following command in your terminal:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
Or, if you prefer using Wget:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
This command will install NVM on your system. You may need to restart your terminal or run source ~/.bashrc (or ~/.zshrc if you use Zsh) to start using NVM.
Check NVM Version
You can verify that NVM has been installed correctly by typing:
nvm --version
List available Node.js versions
You can list the available Node.js versions by running:
nvm ls-remote
This should display the version of NVM that you installed.
Install a Specific Version of Node.js
To install a specific version of Node.js, use the following command:
nvm install X.X.X
Replace X.X.X with the version number you want to install. For example, to install Node.js version v22.21.1:
nvm install v22.21.1
Use the Installed Node.js Version
Once the installation is complete, you can use the installed version by typing:
nvm use X.X.X
For example:
nvm use v22.21.1
You can check the current Node.js version in use with:
node -v
Set a Default Node.js Version (Optional)
If you want to set a default Node.js version to be used in new shell sessions, you can type:
nvm alias default X.X.X
For example, to set version v22.21.1 as the default:
nvm alias default v22.21.1
Now you have successfully installed and managed a specific version of Node.js using NVM.
Remember that you can always switch to different versions using the nvm use command.