Recently, I had to work on multiple angular apps, one of which is running using angular 10 and other using angular 16.
Hence, I needed different versions of node. After doing somewhat research, I found that the steps are deterministic and are easy to follow.
In this blog, I am going to share the steps on how to configure nvm on mac. Here are the steps:
- Uninstall any existing version of node
- brew uninstall --ignore-dependencies node
- brew uninstall --force node
- Install nvm using brew
- brew install nvm
- Export nvm directory:
export NVM_DIR="$HOME/.nvm" - Add nvm to shell:
Add nvm to your shell profile: To make nvm available every time you open a new terminal window, you will need to add the following line to your shell profile (e.g., ~/.bash_profile or ~/.zshrc):
source $(brew --prefix nvm)/nvm.sh
- Verify by running nvm --version
- Yay! nvm is configured.
- To install a specific version:
nvm install <version>
e.g. nvm install 18.17.0 - To switch to a specific version:
nvm use 18.17.0 - To List available versions:
nvm ls-remote - To list local versions:
nvm ls