GNVM - Node.js version manager on Windows by Go (ksria.com)
GNVM 使用 Go 语言编写的 Node.js 多版本管理器
GNVM 是一个简单的 Node.js 多版本管理器,类似 nvm nvmw nodist 。
下载并解压缩 gnvm.exe 保存到任意文件夹,并将此文件夹加入到环境变量 Path。
下载并解压缩 gnvm.exe 保存到 Node.js 所在的文件夹。
C:\Users\23013>gnvm -h
Usage of gnvm:
Usage:
gnvm [flags]
gnvm [command]
Available Commands:
config Setter and getter .gnvmrc file
use Use any the local already exists of Node.js version
ls Show all [local] [remote] Node.js version
install Install any Node.js version
uninstall Uninstall local Node.js version and npm
update Update Node.js latest version
npm NPM version management
session Set any local Node.js version to session Node.js version
search Search and Print Node.js version detail usage wildcard mode or regexp mode
node-version Show [global] [latest] Node.js version
reg Add config property [noderoot] to Environment variable [NODE_HOME]
version Print GNVM version number
help [command] Help about any command
Available Flags:
--help=false: help for gnvm
Use "gnvm help [command]" for more information about that command.
C:\Users\23013>
C:\Users\23013>gnvm install 20.11.0
Start download Node.js versions [20.11.0].
20.11.0: 98% [=================================================>_] 39s
--------
End download.
C:\Users\23013>gnvm ls
Notice: gnvm.exe root is D:\devsoftware\nodejs\
v12.22.12
v14.19.1 -- x86
v14.21.3
v14.21.3 -- x86
v16.20.2
v18.16.0
v18.18.2
v18.19.0
v20.10.0 -- global
v20.10.0 -- x86
v20.11.0
C:\Users\23013>
# 安装 20.11.0版本
C:\Users\23013>gnvm use 20.11.0
Set success, global Node.js version is 20.11.0.
# 查看版本
C:\Users\23013>node -v
v20.11.0
C:\Users\23013>
命令
gnvm search *.*.*
C:\Users\23013>gnvm search *.*.*
Search Node.js version rules [*.*.*] from http://npm.taobao.org/mirrors/node/index.json, please wait.
+--------------------------------------------------+
| No. date node ver exec npm ver |
+--------------------------------------------------+
1 2024-01-22 21.6.1 x86 x64 10.2.4
2 2024-01-14 21.6.0 x86 x64 10.2.4
3 2023-12-19 21.5.0 x86 x64 10.2.4
4 2023-12-05 21.4.0 x86 x64 10.2.4
5 2023-11-30 21.3.0 x86 x64 10.2.4
6 2023-11-14 21.2.0 x86 x64 10.2.3
7 2023-10-24 21.1.0 x86 x64 10.2.0
8 2023-10-17 21.0.0 x86 x64 10.2.0
9 2024-01-09 20.11.0 x86 x64 10.2.4
10 2023-11-22 20.10.0 x86 x64 10.2.3
11 2023-10-24 20.9.0 x86 x64 10.1.0
12 2023-10-13 20.8.1 x86 x64 10.1.0
13 2023-09-28 20.8.0 x86 x64 10.1.0
14 2023-09-18 20.7.0 x86 x64 10.1.0
15 2023-09-07 20.6.1 x86 x64 9.8.1
16 2023-08-23 20.6.0 x86 x64 9.8.1
17 2023-08-09 20.5.1 x86 x64 9.8.0
18 2023-07-19 20.5.0 x86 x64 9.8.0
19 2023-07-04 20.4.0 x86 x64 9.7.2
20 2023-06-20 20.3.1 x86 x64 9.6.7
21 2023-06-08 20.3.0 x86 x64 9.6.7
22 2023-05-16 20.2.0 x86 x64 9.6.6
23 2023-05-03 20.1.0 x86 x64 9.6.4
24 2023-04-17 20.0.0 x86 x64 9.6.4
25 2023-04-10 19.9.0 x86 x64 9.6.3
26 2023-03-15 19.8.1 x86 x64 9.5.1
27 2023-03-14 19.8.0 x86 x64 9.5.1
28 2023-02-21 19.7.0 x86 x64 9.5.0
29 2023-02-16 19.6.1 x86 x64 9.4.0
30 2023-02-01 19.6.0 x86 x64 9.4.0
31 2023-01-24 19.5.0 x86 x64 9.3.1
32 2023-01-05 19.4.0 x86 x64 9.2.0
33 2022-12-14 19.3.0 x86 x64 9.2.0
34 2022-11-29 19.2.0 x86 x64 8.19.3
35 2022-11-14 19.1.0 x86 x64 8.19.3
36 2022-11-04 19.0.1 x86 x64 8.19.2
37 2022-10-17 19.0.0 x86 x64 8.19.2
38 2023-11-29 18.19.0 x86 x64 10.2.3
39 2023-10-13 18.18.2 x86 x64 9.8.1
40 2023-10-10 18.18.1 x86 x64 9.8.1
41 2023-09-18 18.18.0 x86 x64 9.8.1
42 2023-08-08 18.17.1 x86 x64 9.6.7
43 2023-07-18 18.17.0 x86 x64 9.6.7
44 2023-06-20 18.16.1 x86 x64 9.5.1
45 2023-04-12 18.16.0 x86 x64 9.5.1
46 2023-03-05 18.15.0 x86 x64 9.5.0
47 2023-02-21 18.14.2 x86 x64 9.5.0
48 2023-02-16 18.14.1 x86 x64 9.3.1
49 2023-02-01 18.14.0 x86 x64 9.3.1
50 2023-01-05 18.13.0 x86 x64 8.19.3
51 2022-11-04 18.12.1 x86 x64 8.19.2
52 2022-10-25 18.12.0 x86 x64 8.19.2
53 2022-10-13 18.11.0 x86 x64 8.19.2
54 2022-09-28 18.10.0 x86 x64 8.19.2
55 2022-09-23 18.9.1 x86 x64 8.19.1
56 2022-09-07 18.9.0 x86 x64 8.19.1
57 2022-08-24 18.8.0 x86 x64 8.18.0
58 2022-07-26 18.7.0 x86 x64 8.15.0
59 2022-07-13 18.6.0 x86 x64 8.13.2
60 2022-07-06 18.5.0 x86 x64 8.12.1
61 2022-06-16 18.4.0 x86 x64 8.12.1
62 2022-06-02 18.3.0 x86 x64 8.11.0
63 2022-05-17 18.2.0 x86 x64 8.9.0
64 2022-05-03 18.1.0 x86 x64 8.8.0
65 2022-04-18 18.0.0 x86 x64 8.6.0
........
........
+--------------------------------------------------+
命令
gnvm search 18.*.*
C:\Users\23013>gnvm search 18.*.*
Search Node.js version rules [18.*.*] from http://npm.taobao.org/mirrors/node/index.json, please wait.
+--------------------------------------------------+
| No. date node ver exec npm ver |
+--------------------------------------------------+
1 2023-11-29 18.19.0 x86 x64 10.2.3
2 2023-10-13 18.18.2 x86 x64 9.8.1
3 2023-10-10 18.18.1 x86 x64 9.8.1
4 2023-09-18 18.18.0 x86 x64 9.8.1
5 2023-08-08 18.17.1 x86 x64 9.6.7
6 2023-07-18 18.17.0 x86 x64 9.6.7
7 2023-06-20 18.16.1 x86 x64 9.5.1
8 2023-04-12 18.16.0 x86 x64 9.5.1
9 2023-03-05 18.15.0 x86 x64 9.5.0
10 2023-02-21 18.14.2 x86 x64 9.5.0
11 2023-02-16 18.14.1 x86 x64 9.3.1
12 2023-02-01 18.14.0 x86 x64 9.3.1
13 2023-01-05 18.13.0 x86 x64 8.19.3
14 2022-11-04 18.12.1 x86 x64 8.19.2
15 2022-10-25 18.12.0 x86 x64 8.19.2
16 2022-10-13 18.11.0 x86 x64 8.19.2
17 2022-09-28 18.10.0 x86 x64 8.19.2
18 2022-09-23 18.9.1 x86 x64 8.19.1
19 2022-09-07 18.9.0 x86 x64 8.19.1
20 2022-08-24 18.8.0 x86 x64 8.18.0
21 2022-07-26 18.7.0 x86 x64 8.15.0
22 2022-07-13 18.6.0 x86 x64 8.13.2
23 2022-07-06 18.5.0 x86 x64 8.12.1
24 2022-06-16 18.4.0 x86 x64 8.12.1
25 2022-06-02 18.3.0 x86 x64 8.11.0
26 2022-05-17 18.2.0 x86 x64 8.9.0
27 2022-05-03 18.1.0 x86 x64 8.8.0
28 2022-04-18 18.0.0 x86 x64 8.6.0
+--------------------------------------------------+
命令
gnvm search 20.11.0
C:\Users\23013>gnvm search 20.11.0
Search Node.js version rules [20.11.0] from http://npm.taobao.org/mirrors/node/index.json, please wait.
+--------------------------------------------------+
| No. date node ver exec npm ver |
+--------------------------------------------------+
1 2024-01-09 20.11.0 x86 x64 10.2.4
+--------------------------------------------------+
C:\Users\23013>
C:\Users\23013>gnvm npm 10.2.3
Notice: local npm version is 8.19.4
Notice: remote npm version is 10.2.3
Notice: download 10.2.3 version [Y/n]? Y
Start download new npm version v10.2.3.zip
v10.2.3.zip: 100% [==================================================>] 25s
Start unzip and install v10.2.3.zip zip file, please wait.
Set success, current npm version is 10.2.3.
C:\Users\23013>npm -v
D:\devsoftware\nodejs\node_modules\npm\lib\es6\validate-engines.js:31
throw err
^
Error: Cannot find module '@npmcli/config'
Require stack:
- D:\devsoftware\nodejs\node_modules\npm\lib\npm.js
- D:\devsoftware\nodejs\node_modules\npm\lib\cli-entry.js
- D:\devsoftware\nodejs\node_modules\npm\lib\cli.js
- D:\devsoftware\nodejs\node_modules\npm\bin\npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (D:\devsoftware\nodejs\node_modules\npm\lib\npm.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\npm.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\cli-entry.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\cli.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\bin\\npm-cli.js'
]
}
Node.js v20.10.0
D:\devsoftware\nodejs\node_modules\npm\lib\es6\validate-engines.js:31
throw err
^
Error: Cannot find module '@npmcli/config'
Require stack:
- D:\devsoftware\nodejs\node_modules\npm\lib\npm.js
- D:\devsoftware\nodejs\node_modules\npm\lib\cli-entry.js
- D:\devsoftware\nodejs\node_modules\npm\lib\cli.js
- D:\devsoftware\nodejs\node_modules\npm\bin\npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (D:\devsoftware\nodejs\node_modules\npm\lib\npm.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\npm.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\cli-entry.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\lib\\cli.js',
'D:\\devsoftware\\nodejs\\node_modules\\npm\\bin\\npm-cli.js'
]
}
Node.js v20.10.0
由于安装node版本与npm有差异,所以会出现这种错误
查阅了多种处理方法,npm install都无法使用,最终解决方式是下载指定版本的nodejs归档包,并拷贝里面的npm整个目录覆盖到本地解决
下载归档zip包,如
https://nodejs.org/download/release/v20.10.0/node-v20.10.0-win-x64.zip
找到本地的node安装目录,如:
D:\devsoftware\nodejs\node_modules
,并将D:\devsoftware\nodejs\node_modules
中的npm目录删掉从新下载的nodejs归档包中拷贝npm到本地对应的目录,如拷贝到
D:\devsoftware\nodejs\node_modules
法,npm install都无法使用,最终解决方式是下载指定版本的nodejs归档包,并拷贝里面的npm整个目录覆盖到本地解决下载归档zip包,如
https://nodejs.org/download/release/v20.10.0/node-v20.10.0-win-x64.zip
找到本地的node安装目录,如:
D:\devsoftware\nodejs\node_modules
,并将D:\devsoftware\nodejs\node_modules
中的npm目录删掉从新下载的nodejs归档包中拷贝npm到本地对应的目录,如拷贝到
D:\devsoftware\nodejs\node_modules