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 成功運行項目


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM