以下操作需要管理员打开cmd
C:\WINDOWS\system32>gnvm version
Waring: config file C:\Program Files\nodejs\\.gnvmrc is not exist.
Notice: Config file C:\Program Files\nodejs\\.gnvmrc create success.
Current version 0.2.0 64 bit.
Copyright (C) 2014-2016 Kenshin Wang <kenshin@ksria.com>
See https://github.com/kenshin/gnvm for more information.
C:\WINDOWS\system32>gnvm config
Notice: config file path C:\Program Files\nodejs\\.gnvmrc
gnvm config registry is http://nodejs.org/dist/
gnvm config noderoot is C:\Program Files\nodejs\
gnvm config globalversion is 8.12.0
gnvm config latestversion is unknown
C:\WINDOWS\system32>gnvm search 12.*.*
Search Node.js version rules [12.*.*] from http://nodejs.org/dist/index.json, please wait.
+--------------------------------------------------+
| No. date node ver exec npm ver |
+--------------------------------------------------+
1 2020-04-28 12.16.3 x86 x64 6.14.4
2 2020-04-08 12.16.2 x86 x64 6.14.4
3 2020-02-14 12.16.1 x86 x64 6.13.4
4 2020-02-11 12.16.0 x86 x64 6.13.4
5 2020-02-05 12.15.0 x86 x64 6.13.4
6 2020-01-07 12.14.1 x86 x64 6.13.4
7 2019-12-16 12.14.0 x86 x64 6.13.4
8 2019-11-19 12.13.1 x86 x64 6.12.1
9 2019-10-21 12.13.0 x86 x64 6.12.0
10 2019-10-11 12.12.0 x86 x64 6.11.3
11 2019-10-01 12.11.1 x86 x64 6.11.3
12 2019-09-25 12.11.0 x86 x64 6.11.3
13 2019-09-04 12.10.0 x86 x64 6.10.3
14 2019-08-26 12.9.1 x86 x64 6.10.2
15 2019-08-20 12.9.0 x86 x64 6.10.2
16 2019-08-15 12.8.1 x86 x64 6.10.2
17 2019-08-06 12.8.0 x86 x64 6.10.2
18 2019-07-23 12.7.0 x86 x64 6.10.0
19 2019-07-03 12.6.0 x86 x64 6.9.0
20 2019-06-26 12.5.0 x86 x64 6.9.0
21 2019-06-04 12.4.0 x86 x64 6.9.0
22 2019-05-22 12.3.1 x86 x64 6.9.0
23 2019-05-21 12.3.0 x86 x64 6.9.0
24 2019-05-07 12.2.0 x86 x64 6.9.0
25 2019-04-29 12.1.0 x86 x64 6.9.0
26 2019-04-23 12.0.0 x86 x64 6.9.0
+--------------------------------------------------+
C:\WINDOWS\system32>gnvm install 12.16.3
Start download Node.js versions [12.16.3].
12.16.3: 100% [==================================================>] 36s
--------
End download.
C:\WINDOWS\system32>gnvm ls
Notice: gnvm.exe root is C:\Program Files\nodejs\\
v12.16.3
C:\WINDOWS\system32>gnvm node-version
Node.js global version is 8.12.0.
Waring: latest Node.js version is unknown, please use gnvm install latest -g or gnvm update latest. See 'gnvm help node-version'.
Notice: remote Node.js latest version is 14.2.0 from http://nodejs.org/dist/.
C:\WINDOWS\system32>gnvm use 12.16.3
Set success, global Node.js version is 12.16.3.
https://blog.csdn.net/qq_42840269/article/details/85165196
官方文档:https://github.com/Kenshin/gnvm
下载之后将所下载的gnvm.exe文件放到node.js目录下,和node.exe同级。管理员打开cmd,然后进行验证,输入:gnvm version。
以下很多命令都与新版本(官方文档提供)不同
然后进行配置,命令与官方文档提供不同,为 gnvm config init(init和INIT有区别)
gnvm node-version
使用如下,报错
C:\WINDOWS\system32>gnvm config registry TAOBAO
Waring: TAOBAO need http://
Error: registry value http://TAOBAO must url valid.
换成以下:
C:\WINDOWS\system32>gnvm config registry npm.taobao.org/mirrors/node
Waring: npm.taobao.org/mirrors/node need http://
Set success, registry new value is http://npm.taobao.org/mirrors/node/
C:\WINDOWS\system32>gnvm help
Usage:
gnvm [flags]
gnvm [command]
Available Commands:
version Print the version number of gnvm.exe
install Install any node.exe version
uninstall Uninstall local node.exe version
use Use any version of the local already exists
update Update latest node.exe
ls List show all <local> <remote> node.exe version
node-version Show <global> <latest> node.exe version
config Setter and getter registry
help [command] Help about any command
Available Flags:
--help=false: help for gnvm
Use "gnvm help [command]" for more information about that command.