npm install 时报 npm ERR command git --no-replace-objects ls-remote ssh

PS D:\code\www\4.0_backview> npm install
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pc\AppData\Local\npm-cache\_logs\2022-01-19T01_46_52_518Z-debug.log

操作一: 检查.gitconfig文件
win10一般在: /c/Users/pc/.gitconfig
在最底部添加:

# 将git://的都替换成https
[url "https://github.com/nhn/raphael.git/"]
insteadOf = git://github.com/nhn/raphael.git/

再次npm install , 无果, 再看操作二

操作二: github添加ssh

ssh-keygen -t rsa -b 2048 -C "你自己的邮箱地址"
# 回车后如果你需要填写多个ssh, 则直接写绝对路径, eg: /c/Users/pc/.ssh/github_id_rsa, 防止与gitee有相冲突的文件
cat ~/..sh/github_id_rsa.pub
# 复制到github ssh

在这里插入图片描述

再试一试
出现443的, 再跑多几次就好了, 已经不是上面出现的问题点了, 只是国内网络连通的问题, 你懂的~

PS D:\code\www\4.0_backview> npm install --registry=https://registry.npm.taobao.org
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
npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed to connect to github.com port 443: Timed out
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pc\AppData\Local\npm-cache\_logs\2022-01-19T02_11_27_611Z-debug.log
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值