gnvm安装+使用gnvm安装node——gnvm:一个好用的node版本管理器

一、新版本安装

以下操作需要管理员打开cmd

1.查看gnvm版本,验证是否安装成功
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.
2.配置gnvm
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
3.查询node版本
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
+--------------------------------------------------+
4.安装指定版本node(本地安装)
C:\WINDOWS\system32>gnvm install 12.16.3
Start download Node.js versions [12.16.3].
12.16.3: 100% [==================================================>] 36s
--------
End download.
5.查询本地所有的node版本
C:\WINDOWS\system32>gnvm ls
Notice: gnvm.exe root is C:\Program Files\nodejs\\
v12.16.3

当前使用的是哪一个版本,global就是哪个版本
在这里插入图片描述

6.查询global、latest的node版本
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/.
7.使用本地已存在的某个node版本
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

二、老版本的坑

  • 指令不同
  • 下载地址不同
1.1 安装gnvm

下载之后将所下载的gnvm.exe文件放到node.js目录下,和node.exe同级。管理员打开cmd,然后进行验证,输入:gnvm version。

以下很多命令都与新版本(官方文档提供)不同

1.2 配置

然后进行配置,命令与官方文档提供不同,为 gnvm config init(init和INIT有区别)
在这里插入图片描述

1.3 查看当前所有的node版本
gnvm node-version

在这里插入图片描述

1.4 更换淘宝镜像

使用如下,报错

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/
1.5该版本提供的指令
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.
  • 5
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值