1. What is nvm?
Node Version Manager
(NVM) is a very popular tool for managing multiple on the same systemVersion.
NVM
Allows you to install, use and switch differentVersion, which is very useful for developers, especially when you need to test different versions of the application.
2. Install nvm
First, you need to install nvm on your system. The installation method varies according to different operating systems:
2.1 For MacOS (using Homebrew)
brew install nvm
2.2 For Linux (taking Ubuntu as an example)
curl -o- /nvm-sh/nvm/v0.39.1/ | bash
2.3 For Windows
You can passPowerShell
Script installationNVM
:
iwr /coreybutler/nvm-windows/master/install.ps1 -useb | iex
3. Configure nvm
After the installation is complete, you may need to configure environment variables. For most Linux and MacOS systems, NVM installation scripts will automatically add necessary configurations to your shell configuration files (such as .bashrc or .zshrc). For Windows, you may need to manually add environment variables.
4. Use nvm to manage Node version
After you have installed and configured NVM, you can use the following command to manage the version:
4.1 List available Node versions
nvm list-remote
4.2 Installing a specific version of Node
nvm install 14.17.0
4.3 Switch to the installed Node version
nvm use 14.17.0
Or, switch directly during installation:
nvm install 14.17.0 && nvm use 14.17.0
4.4 Set the default Node version
nvm alias default 14.17.0
5. Uninstall the Node version
If you no longer need a certain versionNode
, you can uninstall it using the following command:
nvm uninstall 14.17.0
6. Check the currently used Node version
To check the currently in useNode
Version, can be used:
node -v
Or useNVM
Command:
nvm current
Through the above steps, you can easily useNVM
Come and manage yourVersion. This is very helpful for maintaining project dependencies and testing applications in different environments.
This is the end of this article about using NVM to manage Node version. For more information about NVM management Node version, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!