NVM
Package management tools
Install
⭐Note: If you have downloaded node before installation, you must delete the original node!
- VisitNVM-Windows’s GitHub page:
- Click nvm-setup.exe.
-
Follow the prompts to the next step and select a custom location for the file location.
-
Verify that the installation was successful
nvm version
. If successful, it will display the version number of NVM.
use
- nvm list available View all versions that can be downloaded
- nvm install 18.18.0 download the version to use
- nvm use 18.18.0 uses this node version
Configuration
-
Set node_globel, node_cache configuration
# 全局安装路径 npm config set prefix "路径" # 全局缓存路径 npm config set cache "路径" # 配置完后请确认配置成功 npm config ls
-
Open computer environment configuration-environment variables
- The path in the user variable, and finally add the path to node_globel just set
-
npm replaces domestic mirror source
// 查询源 npm config get registry // 更换国内源 npm config set registry https://registry.npmmirror.com
Common commands
- nvm off // Disable node.js version management (do not uninstall anything)
- nvm on // Enable node.js version management
- nvm install // The naming of installing node.js version is the version number. For example:
nvm install 8.12.0
- nvm uninstall // Uninstall node.js is a command to uninstall the specified version of nodejs. Use it when the installation fails.
- nvm ls // Display all installed node.js versions
- nvm list available // Display all node.js versions that can be installed
- nvm use // Switch to use the specified nodejs version
- nvm v // Display nvm version
- nvm install stable // Install the latest stable version
nvm command line operation command
- nvm list is to find all node versions on this computer
- nvm list View installed versions
- nvm list installed View installed versions
- nvm list available View the versions that can be installed on the network
- nvm install installs the latest version of nvm
- nvm use ## Switch to use the specified version node
- nvm ls lists all versions
- nvm current displays the current version
- nvm alias ## Add aliases to different version numbers
- nvm unalias ## Delete a defined alias
- nvm reinstall-packages ## In the current version of node environment, reinstall the npm package with the specified version number globally.
- nvm on opens nodejs control
- nvm off turns off nodejs control
- nvm proxy View settings and proxy
- nvm node_mirror [url] Set or view node_mirror in setting.txt. If not set, the default is https://nodejs.org/dist/
nvm npm_mirror [url] Set or view npm_mirror in setting.txt. If not set, the default is: https://github.com/npm/npm/archive/. - nvm uninstall uninstalls the specified version
- nvm use [version] [arch] switches the specified node version and number of bits
- nvm root [path] Set and view the root path
- nvm version View the current version