锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

git--解决exited with error code: 128

时间:2023-01-28 13:30:00 插座连接器dc060t00

原文网址:git--解决exited with error code: 128_IT利刃出鞘的博客-CSDN博客

简介

本文介绍了如何解决git的报错:exited with error code: 128

问题复现

使用npm install命令下载前端项目(本vue-element-admin依赖项目,报告以下错误:

npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! Error while executing:
npm ERR! d:\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=No such file or directory
npm ERR!
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR! E:\work\npm\node_cache\_logs\2022-06-03T00_25_44_783Z-debug.log

原因分析

有些库有变化,不能通过git:在这个时候,我们可以改用它https:/来访。

解决方案

在请求git:///地址自动替换https://,命令如下:

git config --global url."https://".insteadOf git://

执行上述命令后,再执行npm install,成功:

E:\work\WebStorm_proj\frontend_others\vue-element-admin>npm install npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates. npm WARN deprecated chokidar@2.1.5: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported  > ejs@2.7.4 postinstall E:\work\WebStorm_proj\frontend_others\vue-element-admin\node_modules\ejs > node ./postinstall.js  ...  > core-js@2.6.12 postinstall E:\work\WebStorm_proj\frontend_others\vue-element-admin\node_modules\node-plop\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}"  npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})  added 2043 packages from 2006 contributors in 69.461s  103 packages are looking for funding   run `npm fund` for details

备注

如果您想删除此设置,命令如下:

git config --global unseturl."https://".insteadOf

url..insteadOf详解

官网:https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf

官网介绍

url..insteadOf

Any URL that starts with this value will be rewritten to start, instead, with . In cases where some site serves a large number of repositories, and serves them with multiple access methods, and some users need to use different access methods, this feature allows peope to specify any of the equivalent URLs and have Git automatically rewrite the URL to the best alternative for the particular user, even for a never-before-seen repository on the site. When more than one insteadOf strings match a given URL, the longest match is used.

Note that any protocol restrictions will be applied to the rewritten URL. If the rewrite changes the URL to use a custom protocol or remote helper, you may need to adjust the protocol.*.allow config to permit the request. In particular, protocols you expect to use for submodules must be set to always rather than the default of user. See the description of protocol.allow above.

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章