Installation, configuration and use of nvm under Windows

Table of contents

One: Introduction to nvm

Two: nvm download and installation

Three: nvm configuration mirroring

Four: Basic use of nvm

Five: Some common commands of nvm


One: Introduction to nvm

The full name of nvm is nodejs version manage , which is a very good nodejs version management tool . It mainly realizes the installation of nodejs version and switches the currently used nodejs version through the command line.

nvm can realize computer installation and management of multiple versions of node.js. Different node versions need to be used for development in the company's new and old projects. Through nvm, nodejs can be directly downloaded and nodejs versions can be switched at any time, which greatly reduces the burden on front-end programmers The time cost of switching nodejs versions.

Two: nvm download and installation

Before downloading nvm, if node.js has been installed in the original computer, you need to uninstall and delete it first, and then check the environment variables. If there is node.js, please remove it to ensure that there is no node.js left in the system

Nvm download URL: https://github.com/coreybutler/nvm-windows/releases

1. Enter the nvm download address and download the nvm-setup installation package

2. After the download is complete, unzip and run the installation file, pay attention to the installation path without Chinese characters, spaces, etc.

3. After the installation is complete, open cmd, enter nvm, and the following content appears, indicating that the installation is successful

Three: nvm configuration mirroring

Find the setting.txt file under the nvm installation path , open it, and add the following information

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

The configuration of Taobao mirror can be completed

Four: Basic use of nvm

1. Install the specified version of node

nvm install 版本号

2. Query to see the installed nodejs version

nvm list

3. Use the specified version of node.js

nvm use 版本号

4. Display the current version

nvm current

Five: Some common commands of nvm

  • nvm arch : Shows whether node is running on 32-bit or 64-bit.
  • nvm install <version> [arch] : Install node, version is a specific version or the latest stable version latest. The optional parameter arch specifies whether to install the 32-bit or 64-bit version, and the default is the system bit. --insecure can be added to bypass SSL for remote servers.
  • nvm list [available] : Show the list of installed ones. The optional parameter available displays all versions that can be installed. list can be simplified to ls.
  • nvm on : Enable node.js version management.
  • nvm off : Turn off node.js version management.
  • nvm proxy [url] : Set download proxy. Without the optional parameter url, the current proxy is displayed. Setting url to none removes the proxy.
  • nvm node_mirror [url] : Set node mirror. The default is https://nodejs.org/dist/ . If no url is specified, the default url will be used. After setting, you can go to the settings.txt file in the installation directory to view it, or you can directly operate in this file.
  • nvm npm_mirror [url] : Set npm mirror. https://github.com/npm/cli/archive/ . If no url is specified, the default url will be used. After setting, you can go to the settings.txt file in the installation directory to view it, or you can directly operate in this file.
  • nvm uninstall <version> : Uninstall the specified version node.
  • nvm use [version] [arch] : Use the specified version node. 32/64 bits can be specified.
  • nvm root [path] : Set the directory where different versions of node are stored. If not set, the current directory is used by default.
  • nvm version : Displays the nvm version. version can be simplified to v


 

Guess you like

Origin blog.csdn.net/qq_42691298/article/details/129358467