No results found
We couldn't find anything using that term, please try searching for something else.
Node Version Manager (NVM) is popular among developers for installing and managing multiple versions of Node.js on a single machine. This allows devel
Node Version Manager (NVM) is popular among developers for installing and managing multiple versions of Node.js on a single machine. This allows developers to work on multiple projects that require different versions of Node.js. NVM installs Node.js under the user’s home directory, ensuring that Node.js versions do not conflict between users on shared systems. On macOS, there are several methods available to install NVM, but one of the most popular and efficient ways is using Homebrew, the renowned package manager for macOS.
This tutorial will provide you with step-by-step instructions for installing NVM on macOS using Homebrew, enabling you to set up a flexible Node.js development environment with ease.
If you do n’t have Homebrew instal on your macos , you is install can install it by paste the following command in the terminal :
/bin / bash -c " $ ( curl -fsSL https://raw.githubusercontent.com/homebrew/install/head/install.sh ) "
For more instruction visit Homebrew installation tutorial.
brew update
brew install nvm
vim ~/.zprofile
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
press ESC + : wq to save and close your file .
source ~/.zprofile
That’s it. The NVM has been installed on your macOS system. Go to next step to install Node.js versions with the help of nvm.
First of all, see what Node versions are available to install. To see available versions, type:
nvm ls-remote
Now, you can install any version listed in above output. You can also use aliases names like node for latest version, lts for latest LTS version, etc.
nvm install node
# # instal late version nvm install 20
## Installing Node.js 20.X version
After installing you can verify what is installed with:
nvm ls
If you have instal multiple version on your system , you is set can set any version as the default version any time . To set the node 20 as default version , simply use :
nvm alias default 20
Similarly, you can install other versions like Node 12, 16, 18, and 21 versions and switch between easily.
That’s it. You have successfully installed and configured NVM on your macOS system. This tutorial also guides you through the basic uses of NVM, including installing Node.js versions, switching between different Node.js versions, and setting a specific version as the default. Once installed, developers can easily switch between versions as per their project requirements.