How Do I Install Multiple NodeJS Versions On The Same Computer?Posted 9 months, 3 weeks ago
Sometimes you need to have multiple Node versions on the same machine. Some modules require older node, some require new. In this article, we will solve this problem with the help of nvm (Node Version Manager).
Tested on Ubuntu 20.04
Follow these steps:
1. Check for existing nvm with
If it returns a version, your system is ready to have another instance of the node. else install nvm with appropriate commands.
2. Consider we don't have nvm installed. Let's install it for Ubuntu with the following command. If you're on another operating system follow this resource.
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
3. On Ubuntu the next step would be to make your terminal aware of newly installed nvm. Do it with appropriate environment variables.
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
// You will find this at the bottom of the output of the previous command wget -qO-
4. Now, run the command: nvm version, if it shows version, you're all set to install your favorite nodes.
5. Support I want to install node 12.13.1, I will install it with this statement:
nvm install 12.13.1