安装gnvm,nodejs,npm使用方法

2023-12-22 13:29:53

安装gnvm,nodejs,npm使用方法

一、安装gnvm
gnvm.exe下载地址:
https://download.csdn.net/download/hsg77/88651752

http://ksria.com/gnvm/#download

二、配置gnvm环境变量
新建目录,如:d:/nodejs 并把gnvm.exe存储到此目录
并把d:/nodejs目录放入到系统path变量中
windows中:
电脑-右键-属性-高级系统设置-环境变量-系统变量-Path-编辑-新建
三、验证
gnvm version

PS D:\nodejs> gnvm version
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.

四、安装node.js版本
注意:cmd或powershell以管理员身份运行
设置TAOBAO映像地址

gnvm config registry TAOBAO
gnvm install 16.20.2
gnvm ls
gnvm use 16.20.2
node -v
v16.20.2
PS D:\nodejs> gnvm install 18.17.0
Start download Node.js versions [18.17.0].
18.17.0: 100% [==================================================>] 12s
--------
End download.

PS D:\nodejs> gnvm ls
Notice: gnvm.exe root is D:\nodejs\
v16.20.2 -- global
v18.17.0
v20.10.0
v20.10.0 -- x86

PS D:\nodejs> gnvm use 18.17.0
Error: copy D:\nodejs\18.17.0 to D:\nodejs\ folder Error: open D:\nodejs\\node.exe: The process cannot access the file because it is being used by another process..

PS D:\nodejs> gnvm use 18.17.0
Set success, global Node.js version is 18.17.0.

PS D:\nodejs> gnvm ls
Notice: gnvm.exe root is D:\nodejs\
v16.20.2
v18.17.0 -- global
v20.10.0
v20.10.0 -- x86

PS D:\nodejs> gnvm use 16.20.2
Set success, global Node.js version is 16.20.2.

PS D:\nodejs> gnvm ls
Notice: gnvm.exe root is D:\nodejs\
v16.20.2 -- global
v18.17.0
v20.10.0
v20.10.0 -- x86

 node -v
v16.20.2

五:安装npm

gnvm npm global
PS D:\nodejs> node -v
v16.20.2
PS D:\nodejs> gnvm npm global
Notice: local    npm version is 10.2.3
Notice: remote   npm version is 8.19.4
Notice: download 8.19.4 version [Y/n]? y
Start download new npm version v8.19.4.zip
v8.19.4.zip: 100% [==================================================>] 14s
Start unzip and install v8.19.4.zip zip file, please wait.
Set success, current npm version is 8.19.4.
PS D:\nodejs> npm -v
8.19.4

npm和node的版本是相匹配的,如果不匹配可能会出错。下载的时候不要下载过高的版本(node),也不要过低的版本。
版本参考:https://nodejs.org/en/about/previous-releases
在这里插入图片描述

六、搜索node.js的版本列表
gnvm search ..*

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     2023-12-19   21.5.0      x86 x64   10.2.4
  2     2023-12-05   21.4.0      x86 x64   10.2.4
  3     2023-11-30   21.3.0      x86 x64   10.2.4
  4     2023-11-14   21.2.0      x86 x64   10.2.3
  5     2023-10-24   21.1.0      x86 x64   10.2.0
  6     2023-10-17   21.0.0      x86 x64   10.2.0
  7     2023-11-22   20.10.0     x86 x64   10.2.3
  8     2023-10-24   20.9.0      x86 x64   10.1.0
  9     2023-10-13   20.8.1      x86 x64   10.1.0
  10    2023-09-28   20.8.0      x86 x64   10.1.0
  11    2023-09-18   20.7.0      x86 x64   10.1.0
  12    2023-09-07   20.6.1      x86 x64   9.8.1
  13    2023-08-23   20.6.0      x86 x64   9.8.1
  14    2023-08-09   20.5.1      x86 x64   9.8.0
  15    2023-07-19   20.5.0      x86 x64   9.8.0
  16    2023-07-04   20.4.0      x86 x64   9.7.2
  17    2023-06-20   20.3.1      x86 x64   9.6.7
  18    2023-06-08   20.3.0      x86 x64   9.6.7
  19    2023-05-16   20.2.0      x86 x64   9.6.6
  20    2023-05-03   20.1.0      x86 x64   9.6.4
  21    2023-04-17   20.0.0      x86 x64   9.6.4
  22    2023-04-10   19.9.0      x86 x64   9.6.3
  23    2023-03-15   19.8.1      x86 x64   9.5.1
  24    2023-03-14   19.8.0      x86 x64   9.5.1
  25    2023-02-21   19.7.0      x86 x64   9.5.0
  26    2023-02-16   19.6.1      x86 x64   9.4.0
  27    2023-02-01   19.6.0      x86 x64   9.4.0
  28    2023-01-24   19.5.0      x86 x64   9.3.1
  29    2023-01-05   19.4.0      x86 x64   9.2.0
  30    2022-12-14   19.3.0      x86 x64   9.2.0
  31    2022-11-29   19.2.0      x86 x64   8.19.3
  32    2022-11-14   19.1.0      x86 x64   8.19.3
  33    2022-11-04   19.0.1      x86 x64   8.19.2
  34    2022-10-17   19.0.0      x86 x64   8.19.2
  35    2023-11-29   18.19.0     x86 x64   10.2.3
  36    2023-10-13   18.18.2     x86 x64   9.8.1
  37    2023-10-10   18.18.1     x86 x64   9.8.1
  38    2023-09-18   18.18.0     x86 x64   9.8.1
  39    2023-08-08   18.17.1     x86 x64   9.6.7
  40    2023-07-18   18.17.0     x86 x64   9.6.7
  41    2023-06-20   18.16.1     x86 x64   9.5.1
  42    2023-04-12   18.16.0     x86 x64   9.5.1
  43    2023-03-05   18.15.0     x86 x64   9.5.0
  44    2023-02-21   18.14.2     x86 x64   9.5.0
  45    2023-02-16   18.14.1     x86 x64   9.3.1
  46    2023-02-01   18.14.0     x86 x64   9.3.1
  47    2023-01-05   18.13.0     x86 x64   8.19.3
  48    2022-11-04   18.12.1     x86 x64   8.19.2
  49    2022-10-25   18.12.0     x86 x64   8.19.2
  50    2022-10-13   18.11.0     x86 x64   8.19.2
  51    2022-09-28   18.10.0     x86 x64   8.19.2
  52    2022-09-23   18.9.1      x86 x64   8.19.1
  53    2022-09-07   18.9.0      x86 x64   8.19.1
  54    2022-08-24   18.8.0      x86 x64   8.18.0
  55    2022-07-26   18.7.0      x86 x64   8.15.0
  56    2022-07-13   18.6.0      x86 x64   8.13.2
  57    2022-07-06   18.5.0      x86 x64   8.12.1
  58    2022-06-16   18.4.0      x86 x64   8.12.1
  59    2022-06-02   18.3.0      x86 x64   8.11.0
  60    2022-05-17   18.2.0      x86 x64   8.9.0
  61    2022-05-03   18.1.0      x86 x64   8.8.0
  62    2022-04-18   18.0.0      x86 x64   8.6.0
  63    2022-06-01   17.9.1      x86 x64   8.11.0
  64    2022-04-07   17.9.0      x86 x64   8.5.5
  65    2022-03-22   17.8.0      x86 x64   8.5.5
  66    2022-03-17   17.7.2      x86 x64   8.5.2
  67    2022-03-10   17.7.1      x86 x64   8.5.2
  68    2022-03-09   17.7.0      x86 x64   8.5.2
  69    2022-02-22   17.6.0      x86 x64   8.5.1
  70    2022-02-10   17.5.0      x86 x64   8.4.1
  71    2022-01-18   17.4.0      x86 x64   8.3.1
  72    2022-01-10   17.3.1      x86 x64   8.3.0
  73    2021-12-17   17.3.0      x86 x64   8.3.0
  74    2021-11-30   17.2.0      x86 x64   8.1.4
  75    2021-11-09   17.1.0      x86 x64   8.1.2
  76    2021-10-20   17.0.1      x86 x64   8.1.0
  77    2021-10-19   17.0.0      x86 x64   8.1.0
  78    2023-08-08   16.20.2     x86 x64   8.19.4
  79    2023-06-20   16.20.1     x86 x64   8.19.4
  80    2023-03-28   16.20.0     x86 x64   8.19.4
  81    2023-02-16   16.19.1     x86 x64   8.19.3
  82    2022-12-13   16.19.0     x86 x64   8.19.3
  83    2022-11-04   16.18.1     x86 x64   8.19.2
  84    2022-10-12   16.18.0     x86 x64   8.19.2
  85    2022-09-23   16.17.1     x86 x64   8.15.0
  86    2022-08-16   16.17.0     x86 x64   8.15.0
  87    2022-07-07   16.16.0     x86 x64   8.11.0
  88    2022-06-01   16.15.1     x86 x64   8.11.0
  89    2022-04-26   16.15.0     x86 x64   8.5.5
  90    2022-03-17   16.14.2     x86 x64   8.5.0
  91    2022-03-16   16.14.1     x86 x64   8.5.0
  92    2022-02-08   16.14.0     x86 x64   8.3.1
  93    2022-01-10   16.13.2     x86 x64   8.1.2
  94    2021-12-01   16.13.1     x86 x64   8.1.2
  95    2021-10-26   16.13.0     x86 x64   8.1.0
  96    2021-10-20   16.12.0     x86 x64   8.1.0
  97    2021-10-12   16.11.1     x86 x64   8.0.0
  98    2021-10-08   16.11.0     x86 x64   8.0.0
  99    2021-09-22   16.10.0     x86 x64   7.24.0

本blog地址:https://blog.csdn.net/hsg77

文章来源:https://blog.csdn.net/hsg77/article/details/135148546
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。