In this tutorial, you’ll learn how to run multiple Node.js versions on a new Mac and easily switch between them.
Remove existing Node.js version
First of all, let’s remove the existing Node.js version from your computer.
brew uninstall --ignore-dependencies node
brew uninstall --force node
Install NVM using Homebrew
Let’s install Node Version Manager (NVM). It will allow us to manage multiple active node.js versions.
brew install nvm
Install Node.js via NVM
You can now install a specific Node.js version or install a LTS (Long-term support version).
nvm install --lts
or
nvm install 12.7.0
That’s it. Now you can switch between different Node.js versions using the following command.
nvm use 16
node -v
v16.17.0
nvm use 12
node -v
v12.7.0
I hope you learned something new today. And if you did, please leave a comment and check other Node.js tutorials.
Cheers,
Renat Galyamov
Want to share this with your friends?
👉renatello.com/install-nodejs-using-nvm