在github下载的项目运行时,进行npm install安装依赖时,出现如下错误:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/nhn/raphael.git
npm ERR! [email protected]: Permission denied (publickey).
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 ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Acer\AppData\Local\npm-cache\_logs\2023-02-09T12_33_12_237Z-debug-0.log
报错图片:
![](https://img-blog.csdnimg.cn/img_convert/2d0813d8c8f647faa559842b24373d59.png)
解决办法:
实际产生错误的原因是ssh密钥的问题,只要在github添加上密钥就可以了。
查找ssh密钥:c盘->user(用户)->主机名字->.ssh
然后复制文件里面的内容到github上。
![](https://img-blog.csdnimg.cn/img_convert/a97349f2c02f45a2a43eaa3d513aa34b.png)
![](https://img-blog.csdnimg.cn/img_convert/792e18ecf3eb468cb7db244fb21696f7.png)
重新运行npm istall,即可解决。