在执行下面命令的时候报错
npm i --legacy-peer-deps
安装一会儿就报错
npm ERR! code 128
npm ERR! A git connection error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
网上搜了好多方法,都没解决。下面是我用过的各种方法:
git config --global url."https://".insteadOf ssh://git@
使用这个命令 将ssh 下载变成https就行了
先执行上面的命令,然后npm i安装,错误依旧。
解决方法
桌面右键,git bash here
输入以下
ssh-keygen -t rsa -C “你的邮箱名称”
overwrite 输入y
输入密码的时候直接回车
重复密码输入还是直接回车,然后把github上以前的sshkeys删除,c盘->用户->你的用户名->.ssh->id_rsa.pub里边的字符添加到 github右上角头像->settings->ssh & GPG ->Add sshKeys
第二个大框里输入确认即可
依然无效,执行 ssh -T git@github.com 输出显示:
Hi stormer! You've successfully authenticated, but GitHub does not provide shell access.
说明秘钥应该正常。
npm i --legacy-peer-deps --registry=https://registry.npm.taobao.org
切换到国内源,依然同样错误。
请问这个错误应该怎么解决呢?
这是我在安装PanJiaChen/vue-element-admin https://github.com/PanJiaChen/vue-element-admin
这个框架时候遇到的错误。
npm -v
8.1.0
node -v
v16.13.0
vue -V
@vue/cli 4.5.15
应该就是众所周知的那个原因导致的,但我这复现不出来你这个问题。
你切换国内源只是 npm 的仓库变了,但如果你安装的依赖的
package.json
里有一个依赖就是通过 git 安装的,跟你 npm 源也没有关系。你可以尝试继续用第一种方案(先把 git 协议改成 https 协议),同时启用 FastGithub 这个软件再试试(你自己搜一下就好了)。