Node.js项目依赖安装不上案例(一)

156次阅读
没有评论

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/adobe-webplatform/eve.git
npm ERR!
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 20.205.243.166]: errno=Unknown error
npm ERR!
npm ERR!
npm ERR! exited with error code: 128

这是因为互联网不互联的问题,解决这个问题后,再次安装遇到了另外一个报错:

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/adobe-webplatform/eve.git
npm ERR! 
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

第二次的报错信息跟第一次的报错相近,但是不是同一个原因,第二报错的原因是因为GitHub废弃了 git://协议而导致的,具体信息查阅这里:

可以使用 git config --global url."https://github.com/".insteadOf git://github.com/git://github.com/ 替换为 https://github.com/ ,这样在拉取依赖的时候,就会以 https:// 的方式拉取了,问题就可以解决了。因为这是全局设置,如果想取消的话可以执行该命令:git config --global --unset url.https://github.com/.insteadof 取消。

其他一些细节问题

首先,这是别人在网上购买的一个基于 vue-admin-element 后台模板创建的前端项目,他在安装的时候遇到了上面的问题,让我帮忙解决的,但是由于没有 package-lock.json 文件,无法第一时间知道是哪个包依赖了 eve 这个包,后来在解决以上的问题后,查看了 package-lock.json 的依赖信息,得知:

"raphael": {
      "version": "git+https://github.com/nhn/raphael.git#78a6ed3ec269f33b6457b0ec66f8c3d1f2ed70e0",
      "from": "git+https://github.com/nhn/raphael.git#2.2.0-c",
      "requires": {
        "eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
      }
    },

该项目依赖关系:tui-editor => tui-chart => raphael => eve

vue-admin-element的package.json的 “tui-editor”: “1.2.7”,

tui-editor v1.2.7 Release v1.2.7 · nhn/tui.editor (github.com) 源码nhn/tui.editor at v1.2.7 (github.com)的package.json,依赖 “tui-chart”: “^3.0.1″,没有限制小版本,再看会咱们的package-lock.json,搜索 tui-chart,装了”version”: “3.11.3”,看下它的源码,Release v3.11.3 · nhn/tui.chart (github.com),nhn/tui.chart at v3.0.1 (github.com),如何看下它的package.json的依赖描述,”raphael”: “https://github.com/nhnent/raphael.git#2.2.0-c”,它这里的描述依赖使用的是github的代码仓库,继续查看该仓库的代码,nhn/raphael at v2.2.0-c (github.com),它是fork自DmitryBaranovskiy/raphael: JavaScript Vector Library (github.com)的,看下它的package.json描述,”eve”: “git://github.com/adobe-webplatform/eve.git#eef80ed”也是依赖github代码仓库的,不过这次是指定了一个commit。

其他的一些发现:tui-editor的包名从V2开始变更为@toast-ui/editor,tui-chartv4变更为@toast-ui/chart,也不再依赖raphael.js了Release v4.0.1 · nhn/tui.chart (github.com)

正文完
 0
wujingquan
版权声明:本站原创文章,由 wujingquan 于2023-09-12发表,共计2307字。
转载说明:Unless otherwise specified, all articles are published by cc-4.0 protocol. Please indicate the source of reprint.
评论(没有评论)