vue-element-admin npm install 报错

vue-element-admin 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! no such identity: /c/Users/masterlin/.ssh/github_id_rsa: No such file or directory
npm ERR! git@github.com: 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\masterlin\AppData\Local\npm-cache\_logs\2022-01-03T09_29_27_844Z-debug-0.log

no such identity: /c/Users/masterlin/.ssh/github_id_rsa: No such file or directory

1.没有.ssh/github_id_rsa文件。

找到ssh文件夹:"C:\Users\masterlin.ssh"文件夹,然后在这个文件夹打开cmd,执行以下命令,替换你自己的邮箱

ssh -keygen -t rsa -C "your_email@example.com"

回车
输入密码
再次确认密码

然后生成github,的公钥id_rsa.pub和私钥id_rsa
图片名称

将公钥添加到github的ssh keys上。

再次运行npm install

还是出错,再细看

原来生成的公钥文件名为id_rsa.pub,而项目需要的文件名为github_id_rsa。

改名后,再次运行 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/adobe-webplatform/eve.git
npm ERR! Load key "/c/Users/masterlin/.ssh/github_id_rsa": invalid format
npm ERR! git@github.com: 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\masterlin\AppData\Local\npm-cache\_logs\2022-01-03T09_37_54_026Z-debug-0.log

Load key "/c/Users/masterlin/.ssh/github_id_rsa": invalid format

2. .ssh/github_id_rsa文件文件格式不正确
这次不再是文件不存在,而是文件格式不正确

再次查找问题,最后是生成的公钥的格式是新格式

强制 openSSH 生成旧格式:

 ssh-keygen -m PEM -t rsa -P "" -f filename

命令 ssh-keygen -t rsa 生成ssh,默认是以新的格式生成,id_rsa的第一行变成了“BEGIN OPENSSH PRIVATE KEY” 而不在是“BEGIN RSA PRIVATE KEY”

最后换成旧格式,

npm install 成功下载依赖,

npm run dev 成功运行项目

posted @   MasterLin  阅读(1561)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示