系统版本
适用系统:V10(SP1)
适用架构:X86
其他版本和架构可作参考。
问题描述
使用 npm i 安装依赖的时候有如下报错:
- npm verb stack Error: command failed
- npm verb stack at ChildProcess.<anonymous>(/home/kylin/.nvm/versions/node/v16.5.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
- npm verb stack at ChildProcess.emit (node:events:394:28)
- npm verb stack at maybeClose (node:internal/child_process:1067:16)
- npm verb stack at Process.ChildProcess._handle.onexit(node:internal/child_process:301:5)
- npm verb cwd /home/kylin/electerm
- npm verb Linux 5.4.18-55-generic
- npm verbargv "/home/kylin/.nvm/versions/node/v16.5.0/bin/node" "/home/kylin/.nvm/versions/node/v16.5.0/bin/npm" "i" "--verbose"
- npm verb node v16.5.0
- npm verb npm v7.19.1
- npm ERR! code 128
- npm ERR! command failed
- npm ERR! command git --no-replace-objects ls-remotessh://git@github.com/vscode-icons/vscode-icons.git
- npm ERR! Warning: Permanently added 'github.com,20.205.243.166' (ECDSA)to the list of known hosts.
- npm ERR! git@github.com: Permission denied (publickey).
- npm ERR! fatal:无法读取远程仓库。
- npm ERR!
- npm ERR!请确认您有正确的访问权限并且仓库存在。
复制代码
问题分析:秘钥设置的有问题
问题解决方案:
1.首先需要有 github账号,没有需要注册。
检查有没有在 GitHub的 https://github.com/settings/keys上添加你本机的 SSH key。注意换了电脑是要重新添加的,每台都不一样。
添加 SSH key的方法:
(1)在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有 id_rsa和 id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。
如果没有,打开终端,创建 SSH Key:
- ssh-keygen -t rsa -C "wuzhaohui100@163.com"
- Generating public/private rsa key pair.
- Enter file in which to save the key (/home/kylin/.ssh/id_rsa):
- Enter passphrase (empty for no passphrase):
- Enter same passphrase again:
- Your identification has been saved in /home/kylin/.ssh/id_rsaYour public key has been saved in /home/kylin/.ssh/id_rsa.pubThe key fingerprint is:
- SHA256:bz2TwOS8t6KHgffGtSO8Ereu3/Ae8dDWmaSoZ7Njqo8
- wuzhaohui100@163.com
- The key's randomart image is:
- +---[RSA 3072]----+
- ||
- ||
- |. . |
- |= ..o.o|
- |.S =.o.oo.|
- |. +.o+.* |
- |. X=*B.. |
- |+.%B== |
- |E=@***. |
- +----[SHA256]-----+
复制代码 把邮件地址换成你自己注册 github的邮件地址,然后一路回车,使用默认值即可。
如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有 id_rsa和id_rsa.pub两个文件,这两个就是 SSH Key的秘[/ discuz_code_1 ][/ discuz_code_0 ] 试读已结束,请付费阅读全文。 ¥ 3.00 付费阅读 本文只能试读34%,付费后可阅读全文。 |
|
|
|
|
版权说明:论坛帖子主题均由合作第三方提供并上传,若内容存在侵权,请进行举报