nvm manages node.js version

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

8558467.jpg

After clicking, select nvm-setup.zip at the bottom of the page

8558467.jpg

After decompression, double-click the nvm-setup.exe file to start the installation

8558467.jpg

Here select the directory where nvm is to be installed

8558467.jpg

Here select the directory where node is installed

8558467.jpg

Click install to start the installation. After the installation is complete, open cmd to verify whether the installation is successful

8558467.jpg

The version number appears to indicate that the installation was successful

Common commands

  • nvm arch: Shows nodewhether it is running on 32-bit or 64-bit
  • nvm install <version> [arch]: Install node, versionit can be a specific version or the latest stable version latest. Optional parameter archspecifies whether to install the 32-bit or 64-bit version, the default is the system bit. Can add --bypass insecureremote server'sSSL
  • nvm list [available]: Display the installed list. Optional parameter available, displays all versions that can be installed. listcan be simplified tols
  • nvm on: Enable node.jsversion management
  • nvm off: close node.jsversion management
  • nvm proxy [url]: Set download proxy. With no optional arguments url, displays the current proxy. Set urlto noneremove proxy
  • nvm node_mirror [url]: Set nodemirroring. The default is https://nodejs.org/dist/. If not specified url, the default is used url. After setting, you can go to the installation directory settings.txtfile to view, or directly operate in the file
  • nvm npm_mirror [url]: Set npmmirroring. https://github.com/npm/cli/archive/. If not specified url, the default is used url. After setting, you can go to the installation directory settings.txtfile to view, or directly operate in the file
  • nvm uninstall <version>: Uninstall the specified versionnode
  • nvm use [version] [arch]: Use the specified version node. 32/64 bits can be specified
  • nvm root [path]: Set nodethe directory for storing different versions. If not set, the current directory is used by default
  • nvm version: Display nvmthe version. versioncan 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.txtSettings node_mirroand npm_mirroras 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

8558467.jpg

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

8558467.jpg

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

8558467.jpg

It can be seen that we are indeed using the latest version in the zone

Show available versions

nvm ls available

8558467.jpg

LTS means long-term support version, generally select the version in this list

Guess you like

Origin blog.csdn.net/SongZhengxing_/article/details/129040284