Written by:
Node Version Manager (NVM) is an essential tool for any JavaScript developer. It allows you to manage multiple javascript projects and environments of Node.js and switch between them depending on the project needs. This flexibility helps developers manage dependencies, test new features, and ensure compatibility across different Node versions without disrupting the entire development environment.
In this quick guide, we'll cover how to install NVM on windows, mac or linux computers. But, if you encounter any issues we do have more detailed instructions for each separate operating system:
Since NVM runs on the command line, we will assume you have some fair knowledge about what is and how to use the command line.
Download the Installer from the nvm-windows GitHub repository and download the latest release.
Run the Installer: Launch the downloaded installer. Follow the prompts to install NVM for Windows. Default settings are recommended for most users.
Verify Installation: Open your command prompt and type nvm --version
. If NVM is installed correctly, the version number will be displayed.
🚨 IMPORTANT! Ensure that the NVM directory is added to your system's PATH. The installer usually handles this step.
Here is a more detailed explanation on how to install NVM on windows.
The easiest and recommended is using the curl
or wget
command:
Open Your Terminal: Access your terminal through your macOS or Linux system.
Install Script: Run the following command in the terminal:
1curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Or, if you prefer using wget
:
1wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
1export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" 2[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Restart Your Terminal: To ensure the changes take effect, restart your terminal.
Verify Installation: In the terminal, type nvm --version
. A successful installation will show the version number of NVM.
With NVM installed, you can now install any version of Node.js by simply running nvm install node_version
. For instance, nvm install 14.17.0
will install Node.js version 14.17.0. You can switch between installed versions using nvm use node_version
.
If you encounter any issues during the installation, make sure that:
For more detailed documentation, visit the NVM GitHub Page.