git--解决exited with error code: 128
原文網址: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.461s103 packages are looking for fundingrun `npm fund` for details備注
如果想刪除這個設置,命令如下:
git config --global unset?url."https://".insteadOfurl.<base>.insteadOf詳解
官網:https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf
官網介紹
url.<base>.insteadOf
Any URL that starts with this value will be rewritten to start, instead, with <base>. 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 people 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.
總結
以上是生活随笔為你收集整理的git--解决exited with error code: 128的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于OP放大器的有源模拟滤波器设计--基
- 下一篇: 计算机多媒体的结论,计算机多媒体对初中物