Giter Site home page Giter Site logo

gnvm's Introduction

logo GNVM - Node.js 多版本管理器

Travis Version Gitter Slack Jianliao

GNVM 是一个简单的 Windows 下 Node.js 多版本管理器,类似的 nvm nvmw nodist

c:\> gnvm install latest 1.0.0-x86 1.0.0-x64 5.0.0
Start download Node.js versions [5.10.1, 1.0.0, 1.0.0-x86, 5.0.0].
5.10.1: 18% [=========>__________________________________________] 4s
 1.0.0: 80% [==========================================>_________] 40s
1.0...: 50% [==========================>_________________________] 30s
 5.0.1: 100% [==================================================>] 20s
End download.

c:\> gnvm ls
5.1.1 -- latest
1.0.0
1.0.0 -- x86
5.0.0 -- global

c:\> gnvm use latest
Set success, current Node.js version is 5.10.0.

c:\> gnvm update latest
Update success, current Node.js latest version is 5.10.0.

特色

  • 单文件,不依赖于任何环境。
  • 下载即用,无需配置。
  • 彩色日志输出。
  • 支持多线程下载。
  • 内置 TAOBAO,方便切换,也支持自定义。
  • 支持 NPM 下载/安装/配置。

主页

Website

文档

English | 繁體中文

下载

  • 32-bit | 64-bit 常用地址,Box,速度稍慢

  • 32-bit | 64-bit 备用地址,百度网盘,速度快

  • 32-bit | 64-bit 备用地址,Github

  • 已经安装了go的用户,使用
    go get github.com/Kenshin/gnvm

  • 已经安装了git的用户,使用
    git clone [email protected]:Kenshin/gnvm-bin.git

  • 已经安装了curl的用户,使用
    curl -L https://github.com/Kenshin/gnvm-bin/blob/master/32-bit/gnvm.exe?raw=true -o gnvm.exe
    curl -L https://github.com/Kenshin/gnvm-bin/blob/master/64-bit/gnvm.exe?raw=true -o gnvm.exe

安装

  • 不存在 Node.js 环境

    下载并解压缩 gnvm.exe 保存到任意文件夹,并将此文件夹加入到环境变量 Path

  • 存在 Node.js 环境

    下载并解压缩 gnvm.exe 保存到 Node.js 所在的文件夹。

验证

  • cmd 下,输入 gnvm version,输出 版本说明 则配置成功。

功能

config       配置 .gnvmrc
use          使用某个本地已存在的 Node.js 版本
ls           输出 [local] [remote] Node.js 版本
install      下载/安装任意已知版本的 Node.js
uninstall    删除任意本地已存在的 Node.js
update       下载 Node.js latest 版本并更新到 .gnvmrc 里面
npm          NPM 下载/安装/删除 管理
session      临时设定本地某个已存在的 Node.js 为 全局 Node.js
search       查询并且输出符合查询条件的 Node.js 版本详细信息的列表
node-version 输出 [global] [latest] Node.js 版本
reg          设定 .gnvmrc 属性值 [noderoot] 为 环境变量 [NODE_HOME],并加入到 Path 中
version      查看 gnvm 版本

功能一览

术语

  • global 当前使用的 Node.js
  • latest 稳定版本的 Node.js
  • session 当前 cmd 所对应的环境。(临时环境)
  • .gnvmrc gnvm配置文件,无需手动建立,其中保存了 本地 / 远程 Node.js 版本信息等。
    • registry 下载 node.exe 所对应的库,默认为 DEFAULT,可以更换为 TAOBAO,也支持自定义。(自定义库的结构需要保持一致。
    • noderoot 保存了全局 Node.js 所在的目录。(也是 gnvm.exe 所在的目录。)

入门指南

gnvm.exe 是一个单文件 exe,无需任何配置,直接使用。

.gnvmrc

globalversion: 5.0.1
latestversion: 5.10.1
noderoot: /Users/kenshin/Work/28-GO/01-work/src/gnvm
registry: http://npm.taobao.org/mirrors/node/

更换更快的库 registry

gnvm.exe 内建了 DEFAULTTAOBAO 两个库。

gnvm config registry TAOBAO

安装 多个 Node.js

安装任意版本的 Node.js 包括: 自动匹配 latest / io.js version 以及 选择 32 / 64 位,例如 x.xx.xx-x64

gnvm install latest 1.0.0-x86 1.0.0-x64 5.0.0

卸载本地任意 Node.js 版本

gnvm uninstall latest 1.0.0-x86 1.0.0-x64 5.0.0

切换本地存在的任意版本 Node.js

gnvm use 5.10.1

列出本地已存在的全部 Node.js 版本

c:\> gnvm ls
5.1.1 -- latest
1.0.0
1.0.0 -- x86
5.0.0 -- global

更新本地的 Node.js latest 版本

gnvm update latest

安装 NPM

gnvm 支持安装 npm, 例如:下载最新版的 npm version ,使用 gnvm npm latest

gnvm npm latest

查询 Node.js 版本

可以使用关键字 * 或者 正则表达式 /regxp/,例如: gnvm search 5.*.* 或者 gnvm search /.10./

c:\> gnvm search 5.*.*
Search Node.js version rules [5.x.x] from http://npm.taobao.org/mirrors/node/index.json, please wait.
+--------------------------------------------------+
| No.   date         node ver    exec      npm ver |
+--------------------------------------------------+
1     2016-04-05   5.10.1      x86 x64   3.8.3
2     2016-04-01   5.10.0      x86 x64   3.8.3
3     2016-03-22   5.9.1       x86 x64   3.7.3
4     2016-03-16   5.9.0       x86 x64   3.7.3
5     2016-03-09   5.8.0       x86 x64   3.7.3
6     2016-03-02   5.7.1       x86 x64   3.6.0
7     2016-02-23   5.7.0       x86 x64   3.6.0
+--------------------------------------------------+

例子

1. 不存在 Node.js 环境时,下载 Node.js latest version 并设置为全局 Node.js 。

c:\> gnvm config registry TAOBAO
Set success, registry new value is http://npm.taobao.org/mirrors/node/
c:\> gnvm install latest -g
Notice: local  latest version is unknown.
Notice: remote latest version is 5.10.1.
Start download Node.js versions [5.10.1].
5.10.1: 100% [==================================================>] 13s
End download.
Set success, latestversion new value is 5.10.1
Set success, global Node.js version is 5.10.1.

2. 升级本地 Node.js latest 版本。

c:\> gnvm config registry TAOBAO
Set success, registry new value is http://npm.taobao.org/mirrors/node/
c:\> gnvm update latest
Notice: local  Node.js latest version is 5.9.1.
Notice: remote Node.js latest version is 5.10.1 from http://npm.taobao.org/mirrors/node/.
Waring: remote latest version 5.10.1 > local latest version 5.9.1.
Waring: 5.10.1 folder exist.
Update success, Node.js latest version is 5.10.1.

3. 查看本地 Node.js global and latest 版本。

c:\> gnvm node-version
Node.js latest version is 5.10.1.
Node.js global version is 5.10.1.

4. 验证 .gnvmrc registry 正确性。

c:\> gnvm config registry test
Notice: gnvm config registry http://npm.taobao.org/mirrors/node/ valid ................... ok.
Notice: gnvm config registry http://npm.taobao.org/mirrors/node/index.json valid ......... ok.

5. 本地不存在 NPM 时,安装当前 Node.js 版本对应的 NPM 版本。

c:\ gnvm npm global
Waring: current path C:\xxx\xxx\nodejs\ not exist npm.
Notice: local    npm version is unknown
Notice: remote   npm version is 3.8.3
Notice: download 3.8.3 version [Y/n]? y
Start download new npm version v3.8.3.zip
v3.8.3.zip: 100% [==================================================>] 4s
Start unzip and install v3.8.3.zip zip file, please wait.
Set success, current npm version is 3.8.3.
c:\> npm -v
3.8.7

6. 安装 NPM latest 版本。

c:\ gnvm npm laltest
Notice: local    npm version is 3.7.3
Notice: remote   npm version is 3.8.7
Notice: download 3.8.7 version [Y/n]? y
Start download new npm version v3.8.7.zip
v3.8.7.zip: 100% [==================================================>] 3s
Start unzip and install v3.8.7.zip zip file, please wait.
Set success, current npm version is 3.8.7.
c:\> npm -v
3.8.7

依赖

第三方包

下一步

  • 增加 HTTP_PROXY
  • 自动升级,例如 gnvm upgrad .
  • gnvm.exe 增加 Chocolatey 方案。
  • 支持多系统。( MAC, Linux

相关链接

感谢

许可

license-badge

gnvm's People

Contributors

kenshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gnvm's Issues

npm update failed

win10 1709
gnvm 0.2.0 64bit

PS C:\Users\33201> gnvm npm latest
Error: 'gnvm npm latest' an error has occurred. please check.
Error:
Name  : https://raw.githubusercontent.com/npm/npm/master/package.json
Code  : -1
Error : https://raw.githubusercontent.com/npm/npm/master/package.json an [404] error occurred.

gnvm use latest失败

报 Waring: 7.3.0 folder is not exist node.exe, use 'gnvm ls' get local Node.js version list. See 'gnvm help ls'.
但是实际上7.30目录下有node.exe

找到原因了是之前install latest 没有下载完全,导致node.exe 不完整

gnvm npm global 出错

问题描述

使用gnvm npm global 安装对应版本的npm时,命令执行完成
提示如下:
Start unzip and install v3.10.10.zip zip file, please wait.
Set success, current npm version is 3.10.10.

但是在我的安装目录中,没有生成对应的npm命令行工具。

另外我想知道,不同版本的node_module这里再全局共享一个文件夹这样安装后会冲突吗?

我尝试了几种方法

第一种
安装在F;/NodeJs路径下,安装后,执行gnvm npm global 能够获得npm命令

第二种
安装在以下路径均不能成功(NODE_HOME)
C:\NodeJs
C:\Program Files\NodeJs
C:\ProgramFiles\NodeJs
均提示:
Start unzip and install v3.10.10.zip zip file, please wait.
Set success, current npm version is 3.10.10.
但是在该目录下没有找到对应的版本,我怀疑是需要系统权限的问题。
因此我使用“管理员”权限启动CMD后执行gnvm npm global 仍然无法得到解决

Error : Download size error

执行gnvm install latest时出现以下错误:

C:\Users\XXXXX>gnvm install latest
Notice: local  latest version is unknown.
Notice: remote latest version is 9.2.0.
Start download Node.js versions [9.2.0].
9.2.0: download error.
--------
End download.
Set success, latestversion new value is 9.2.0
Waring:
Name  : http://nodejs.org/dist/v9.2.0/win-x64/node.exe
Code  : -7
Error : Download size error, Error: .read tcp 192.168.11.205:13198->104.20.22.46:80: wsarecv: An existing connection was forcibly closed by the remote host.

win10 没有安装nodejs 切换到TAOBAO源安装npm失败

PS C:\Users\panpengfei> gnvm config registry TAOBAO
Set success, registry new value is http://npm.taobao.org/mirrors/node/
PS C:\Users\panpengfei> gnvm npm latest
Waring: current path D:\Program Files\gnvm\ not exist npm.
Error: 'gnvm npm latest' an error has occurred. please check.
Error:
Name : https://raw.githubusercontent.com/npm/npm/master/package.json
Code : -1
Error : https://raw.githubusercontent.com/npm/npm/master/package.json an [404] error occurred.
PS C:\Users\panpengfei>

Start unzip and install v6.4.1.zip zip file, please wait.
Set success, current npm version is 6.4.1.
PS C:\Users\panpengfei> npm -v
npm : 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • npm -v
  •   + CategoryInfo          : ObjectNotFound: (npm:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

gnvm search 5.*.* error

C:\Users\Administrator>gnvm search 5.*.*
Search Node.js version rules [5.*.*] from http://npm.taobao.org/mirrors/node/ind
ex.json, please wait.
Error: gnvm search an error has occurred. please check. Error: Error: util/print
.go an error has occurred. Error: interface conversion: interface is *json.Synta
xError, not string

C:\Users\Administrator>gnvm version
Current version 0.2.0 64 bit.
Copyright (C) 2014-2016 Kenshin Wang <[email protected]>
See https://github.com/kenshin/gnvm for more information.

这里查询的时候报错。

gnvm use [x.x.x]失败,版本已下载,文件拷贝出错

gnvm.exe与node.exe同在D:\Program Files\nodejs中

Error: copy D:\Program Files\nodejs\10.9.0 to D:\Program Files\nodejs\ folder Error: open D:\Program Files\nodejs\node.exe: The process cannot access the file because it is being used by another process..

image

安装npm6.0.0时出错

安装npm6.0.0的时候会报如下错误:

Waring: current path D:\nodejs\ not exist npm.
Notice: local    npm version is unknown
Notice: remote   npm version is 6.0.0
Notice: download 6.0.0 version [Y/n]? y
Start download new npm version v6.0.0.zip
v6.0.0.zip: 100% [==================================================>] 1s
Start unzip and install v6.0.0.zip zip file, please wait.
Notice: D:\nodejs\node_modules folder create success.
Error: 'gnvm npm 6.0.0' an error has occurred. please check.
Error: unzip v6.0.0.zip an error has occurred.
Error: %!(EXTRA string=open D:\nodejs\node_modules\npm-6.0.0\node_modules\libnpmhook\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\node_modules\http-proxy-agent\node_modules\agent-base\node_modules\es6-promisify\node_modules\es6-promise\lib\es6-promise\promise\all.js: The system cannot find the path specified.)

不知道是否跟6.0.0中的依赖有所变化有关

用gnvm安装npm后原来的模块找不到了

用 npm ls 看不到以前安装的包了,
并且打印 module.paths 也不正确了

记得以前的modules不是在nodejs的安装目录的。
现在定位到nodejs\node_modules下了,
这个是gnvm做出的改变呢?还是npm?
怎么修复

session gns没有效果

项目有2个工程文件(前后端),前端只能运行在node 10+,后端只能在=8运行。

我本地开发调试必须同时启动这两个app,所以我让全局node 10+,并且用session单独启动后端,我的操作是

gnvm session start
gns run 8.xxxxx

这时我再运行后端,结果还是提示正在使用10+版本的node,无法启动.

之前从未用过session这个功能,是我对session功能理解有误,还是我的操作有问题?

无法选择最新的npm

can not find the lastest npm

C:\Users\NICK>gnvm npm latest
Notice: local    npm version is 4.0.2
Notice: remote   npm version is 3.10.9
Notice: download 3.10.9 version [Y/n]? n
Notice: operation has been cancelled.

npm 安装出错

PS D:\NodeJs\vue-manage-system-master> gnvm npm 6.1.0
Notice: local npm version is 5.6.0
Notice: remote npm version is 6.1.0
Notice: download 6.1.0 version [Y/n]? y
Start download new npm version v6.1.0.zip
v6.1.0.zip: 100% [==================================================>] 13s
Start unzip and install v6.1.0.zip zip file, please wait.
Error: 'gnvm npm 6.1.0' an error has occurred. please check.
Error: unzip v6.1.0.zip an error has occurred.
Error: %!(EXTRA string=open C:\Program Files\gnvm\node_modules\npm-6.1.0\node_modules\libnpmhook\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\node_modules\http-proxy-agent\node_modules\agent-base\node_modules\es6-promisify\node_modules\es6-promise\dist\es6-promise.auto.js: The system cannot find the path specified.)

gnvm ls失败

安装后管理员运行,init初始化成功,显示有一个版本的node 10.13.0-x86,但是gnvm ls的时候,就显示没有版本。

go error

Using go for setup,some error like “package gnvm/config: unrecognized import path "gnvm/config" (import path does not begin with hostname)”。
when i see the go file, i replace "gnvm/util" with “github.com/Kenshin/gnvm/util” 。then it works。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.