【vue-element-admin使用问题记录:npm ERR! Error while executing】

vue-element-admin下载配置问题记录:npm ERR! Error while executing

操作

依据官方网站实例进行 vue-element-admin官网

# clone the project
git clone https://github.com/PanJiaChen/vue-element-admin.git

# enter the project directory
cd vue-element-admin

# install dependency
npm install

# develop
npm run dev

npm install报错

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! Error while executing:
npm ERR! D:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/sohee-lee7/Squire.git
npm ERR! 
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!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myung\AppData\Roaming\npm-cache\_logs\2023-04-19T07_47_44_656Z-debug.log

提示git@github.com: Permission denied (publickey),不能读取远程仓库,查看了一些其他帖子,均未能解决。仔细回忆了一下,原来本机只绑定了gitee,未在github添加秘钥,所以问题应该在此。

同一邮箱同时配置Gitee和GitHub

参照文章 Git使用同一个邮箱生成同一个公钥SSH-Key并配置连接Gitee和GitHub,数次失败并尝试亲测可行!

1、执行完ssh-keygen命令后,会在C盘用户目录下生成.ssh/id_rsa和.ssh/id_rsa.pub

$ ssh-keygen -t rsa -C 'xxxxx@email.com'

id_rsa:私钥文件
id_rsa.pub:公钥文件
known_hosts文件在下面会讲到

2、在同级目录下,新建config文件,可以直接新建文本文档,将其后缀一同删除,改名为config
3、打开config文件进行编辑,添加内容如下:

# gitee
Host git.oschina.net
User xxxxx@email.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

# github
Host ssh.github.com
User xxxxx@email.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

4、查看生成的SSH公钥,并将这个SSH公钥分别设置到Gitee和GitHub中

cat ~/.ssh/id_rsa.pub

将显示的SSH公钥复制粘贴到Gitee和Github中添加设置。

5、测试连接

$ ssh -T git@gitee.com
$ ssh -T git@github.com

在第一次连接访问的时候会提示如下信息:

The authenticity of host ‘github.com (20.205.243.166)’ can’t be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?

因为 SSH 需要通过 SSH key fingerprint 来验证远端 host 的真实性,这个时候我们需要输入 y,并按回车即可,同时会在当前目录下(~/.ssh/ 目录下)生成 known_hosts 文件。

访问不同IP机器时会在 known_hosts 文件中保存每一次访问连接的信息。

known_hosts:访问过的机器的公钥,第一次 ssh 其他机器时如果有权限访问,会提示是否保存信息,下次会校验访问该机器的公钥与known_hosts中的是否一致,如果不一致则不能登录过去。

分别出现以下结果则说明访问连接成功。
在这里插入图片描述

总结

没有发现问题一方面是后端选手不熟悉npm使用及相关配置环境依赖,;另一方面太粗心没注意github秘钥问题。
最后回头执行npm install,一路畅通,启动成功
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值