nvm manages node.js version
Introduction
Nvm can manage various local node versions to solve various problems caused by too low or too high node versions
download and install
The download address of each version, it is recommended to download version 1.1.9 and above.
https://github.com/coreybutler/nvm-windows/tags
Click on the page and select download
After clicking, select nvm-setup.zip at the bottom of the page
After decompression, double-click the nvm-setup.exe file to start the installation
Here select the directory where nvm is to be installed
Here select the directory where node is installed
Click install to start the installation. After the installation is complete, open cmd to verify whether the installation is successful
The version number appears to indicate that the installation was successful
Common commands
nvm arch
: Showsnode
whether it is running on 32-bit or 64-bitnvm install <version> [arch]
: Installnode
,version
it can be a specific version or the latest stable versionlatest
. Optional parameterarch
specifies whether to install the 32-bit or 64-bit version, the default is the system bit. Can add --bypassinsecure
remote server'sSSL
nvm list [available]
: Display the installed list. Optional parameteravailable
, displays all versions that can be installed.list
can be simplified tols
nvm on
: Enablenode.js
version managementnvm off
: closenode.js
version managementnvm proxy [url]
: Set download proxy. With no optional argumentsurl
, displays the current proxy. Seturl
tonone
remove proxynvm node_mirror [url]
: Setnode
mirroring. The default is https://nodejs.org/dist/. If not specifiedurl
, the default is usedurl
. After setting, you can go to the installation directorysettings.txt
file to view, or directly operate in the filenvm npm_mirror [url]
: Setnpm
mirroring. https://github.com/npm/cli/archive/. If not specifiedurl
, the default is usedurl
. After setting, you can go to the installation directorysettings.txt
file to view, or directly operate in the filenvm uninstall <version>
: Uninstall the specified versionnode
nvm use [version] [arch]
: Use the specified versionnode
. 32/64 bits can be specifiednvm root [path]
: Setnode
the directory for storing different versions. If not set, the current directory is used by defaultnvm version
: Displaynvm
the version.version
can be simplified tov
Set Taobao Mirror
By default, the foreign address is used, and the download of the node version will be slower
Open the nvm installation purpose, set settings.txt
Settings node_mirro
and npm_mirror
as the domestic mirror address, add the following content to the file
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Use the latest stable version of nvm
input the command
nvm install latest
After the download is complete as shown in the figure, view the list of versions currently installed on the machine, and the asterisk indicates the version currently in use
Switch to the specified version
input the command
nvm use 19.6.0
After entering the command, two confirmation boxes will pop up. After clicking OK, check that the current version is the latest version.
Let's open a new window to view the current node version
It can be seen that we are indeed using the latest version in the zone
Show available versions
nvm ls available
LTS means long-term support version, generally select the version in this list