The NVM (Node Version Manager) is a script used for installing and managing Node. The macOS users can install NVM using the homebrew.
Use this tutorial to help install NVM on your mac and manage Node.js versions.
First remove the installed node version.
brew uninstall --ignore-dependencies node
brew uninstall --force node
Next install NVM
brew update brew install nvm
Create a directory for the nvm config
We need to add the environment variables to the bash profile you use such as ~/.zshrc
export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh
Reset your shell environment.
Check that nvm is installed.
With NVM installed we can now install node.
nvm instal node # install the latest version
nvm install 16 # install a specific version of node
Check node version is installed
Originally published at https://paulund.co.uk.