vue-element-admin 安裝第三包(npm install)時報錯


主要報錯信息:ls-remote ssh://git@github.com/adobe-webplatform/eve.git

npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command D:\nodejs\node.exe D:\nvm\v16.14.0\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! A git connection error occurred
npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git
npm ERR! npm ERR! kex_exchange_identification: read: Connection reset by peer
npm ERR! npm ERR! Connection reset by 20.205.243.166 port 22
npm ERR! npm ERR! fatal: Could not read from remote repository.
npm ERR! npm ERR!
npm ERR! npm ERR! Please make sure you have the correct access rights
npm ERR! npm ERR! and the repository exists.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\AppData\Local\npm-cache\_logs\2022-03-04T08_29_17_072Z-debug-0.log072Z-debug-0.log

npm ERR! A complete log of this run can be found in:                                      g-0.log
npm ERR!     C:\Users\AppData\Local\npm-cache\_logs\2022-03-04T08_27_27_482Z-debug-0.log

解決方案1

修改Git的協議(ssh 替換為 https)

git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"

如果電腦能正常訪問 github 是沒有問題的,但是國內環境經常被牆,所以還是會失敗。
裝個 fastgithub 並運行可以解決
fastgithub 使用說明:https://zhuanlan.zhihu.com/p/428454772
fastgithub 下載地址:https://github.com/dotnetcore/fastgithub/releases
github 下載可能很慢,這里給個百度盤的下載地址:鏈接:https://pan.baidu.com/s/17PiDQU1jaXftKtSjwjocJg 提取碼:6666

這樣基本上就不會有什么問題了。

解決方案2

這里再提供一個鏡像網站的方案:

git config --global url."https://hub.fastgit.xyz/".insteadOf "ssh://git@github.com/"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM