nvm installation (node package management tool)

1. What is nvm?

nvm is a node version management tool, which can easily switch, install, and view node versions. Unlike npm, npm is a management tool for dependent packages.

Second, the installation of nvm

1. Download address

https://github.com/coreybutler/nvm-windows/releases

insert image description here

2. Pay attention here: it is installed to the C drive by default, and there is no need to configure environment variables afterwards

 

3. Install after decompression. The default installation path is the C drive. If the memory of the C drive is not enough, you can install it to the E drive. Generally, I install it on the E drive.

4.finish to complete the installation. Completion can be detected in the following way

5. Change the environment variable. Generally, the environment variable will be automatically set after installation, but an empty directory file needs to be added under NVM_SYMLINK to store the npm package 

NVM_HOME should be the installation directory of nvm, E:\nvmNode\nvm
NVM_SYMLINK should be the installation directory of nvm plus "\nodejs", note that user variables and system variables need to be changed, and then confirm

 
6. Configuration

Find the location of the nvm file and click on setting.txt

Then enter the following code after it: (this is the configuration mirror source)

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

 Three, use

1. Uninstall the previous node.js

2. Open cmd at the location of the nvm file just now

3. Enter the following code to view the node version that nvm can install

nvm ls                      // 看安装的所有node.js的版本
 
nvm list available          // 查显示可以安装的所有node.js的版本

 4. Install the corresponding version

nvm install 版本号 // 例如:nvm install 16.14.2

5. Switch to the installed version

nvm use 版本号           // 切换到使用指定的nodejs版本

6. Check whether the switching is completed 

node -v
nvm list // 如下图

Fourth, some commands of nvm

nvm命令行操作命令
1,nvm nvm list 是查找本电脑上所有的node版本
 
- nvm list 查看已经安装的版本
- nvm list installed 查看已经安装的版本
- nvm list available 查看网络可以安装的版本
 
2,nvm install 安装最新版本nvm
 
3,nvm use <version> ## 切换使用指定的版本node
 
4,nvm ls 列出所有版本
 
5,nvm current显示当前版本
 
6,nvm alias <name> <version> ## 给不同的版本号添加别名
 
7,nvm unalias <name> ## 删除已定义的别名
 
8,nvm reinstall-packages <version> ## 在当前版本node环境下,重新全局安装指定版本号的npm包
 
9,nvm on 打开nodejs控制
 
10,nvm off 关闭nodejs控制
 
11,nvm proxy 查看设置与代理
 
12,nvm node_mirror [url] 设置或者查看setting.txt中的node_mirror,如果不设置的默认是 https://nodejs.org/dist/
  nvm npm_mirror [url] 设置或者查看setting.txt中的npm_mirror,如果不设置的话默认的是: https://github.com/npm/npm/archive/.
 
13,nvm uninstall <version> 卸载制定的版本
 
14,nvm use [version] [arch] 切换制定的node版本和位数
 
15,nvm root [path] 设置和查看root路径
 
16,nvm version 查看当前的版本

Guess you like

Origin blog.csdn.net/qq_45345113/article/details/125908579