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! ssh: connect to host github.com port 22: Connection timed out npm ERR! fatal: Could not read from remote repository. npm ERR! npm ERR! Please make sure you have the correct access rights npm ERR! and the repository exists.
```
npm i 时报错
真的无语了 各种百度搜索 终于总结以下步骤
```
1、检查 ping github.com
包证github 能ping通,
如果ping不通
打开 目录 C:\Windows\System32\drivers\etc 中的 hosts文件
加 140.82.113.3 github.com 如图
再ping一次
这一步是检查本机电脑能否访问github 如果不行 就要使用梯子
2、检查本机是否配置github 秘钥
查看SSH密钥是否存在
- 打开终端或命令提示符。
- 输入以下命令来查看
.ssh
目录下的文件:
你应该能看到类似ls -la ~/.ssh
id_rsa
和id_rsa.pub
的文件,这些是SSH密钥对。
检查SSH密钥是否已添加到GitHub
- 登录到你的GitHub账户。
- 点击你的头像,然后选择 "Settings"(设置)。
- 在左侧菜单中,点击 "SSH and GPG keys"(SSH和GPG密钥)。
- 在这里,你应该能看到一个列表,列出了所有已添加的SSH密钥。检查列表,看是否有你的公钥(通常,公钥的文件名以
.pub
结尾)。
测试SSH连接。
- 打开终端或命令提示符。
- 输入以下命令:
如果配置正确,你将看到一条消息,如 "Hi your_username! You've successfully authenticated, but GitHub does not provide shell access."(其中ssh -T git@github.com
your_username
是你的GitHub用户名)。