1.下载nvm
下载地址
注意:安装前,这里有一点需要注意,如果以前安装过node,需要先卸载,并且要把目录清理干净
nvm安装目录
nodejs 安装目录
查看当前已经安装的nodejs的版本
C:\Users\holyhui>nvm list
No installations recognized.
因为是第一次安装,所以并没有安装任何版本的。
查看可以安装的nodejs版本
安装制定版本的node
这里安装了8.10.0和15.10.0两个版本
//V5.6.0
C:\Users\holyhui>nvm install 8.10.0
Downloading node.js version 8.10.0 (64-bit)...
Complete
Creating E:\worksoftware\nvm\temp
Downloading npm version 3.6.0... Complete
Installing npm v3.6.0...
Installation complete. If you want to use this version, type
nvm use 8.10.0
//V10.5.0
C:\Users\holyhui>nvm install 15.10.0
Downloading node.js version 15.10.0 (64-bit)...
Complete
Creating E:\worksoftware\nvm\temp
Downloading npm version 6.1.0... Complete
Installing npm v6.1.0...
Installation complete. If you want to use this version, type
nvm use 15.10.0
再次查看已安装的版本
C:\Users\holyhui> nvm list
8.10.0
15.10.0
使用指定版本的node
C:\Users\holyhui>nvm use 8.10.0
Now using node v8.10.0 (64-bit)
C:\Users\holyhui>nvm list
15.10.0
* 8.10.0 (Currently using 64-bit executable)
*
C:\Users\holyhui>node -v
v8.10.0
删除指定版本的node
C:\Users\holyhui>npm uninstall 8.10.0