启动vue-element-admin 安装npm install报错npm ERR! code 128npm ERR! An unknown git error occurre

使用vue-element-admin前端项目,前提是有nodejs环境,对于此环境的安装可以参考网上的博客。此博客用于记录启动项目以及遇到的问题、并解决问题的过程。

1、介绍

vue-element-admin是基于element-ui 的一套后台管理系统集成方案 。

功能:https://panjiachen.github.io/vue-element-admin-site/zh/guide/#功能

GitHub地址:https://github.com/PanJiaChen/vue-element-admin

项目在线预览:https://panjiachen.gitee.io/vue-element-admin

vueAdmin-template是基于vue-element-admin的一套后台管理系统基础模板(最少精简版),可作为模 板进行二次开发。

GitHub地址:https://github.com/PanJiaChen/vue-admin-template

可以使用git去github上进行clone,以vue-element-admin为例

新建一个文件夹,右键找到git bash,输入指令:

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

2、运行项目

可以使用vscode打开vue-element-admin项目,找到terminal,在里面直接运行npm run dev,此时会报错,XXXXX-cli等问题,意味着此时没有下载相应的依赖,因此执行命令行:

npm install

此时会报错提示

npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.

rejected....,仔细查看发现是没有权限的问题,那么就是使用管理员的身份打开cmd控制台,进入到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://[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:

仔细读取提示信息,百度尝试解决,得到一共有三种方法

方法一:

git config --global http.sslverify "false"

再次执行npm install ,依然没有解决

方法二:

git config --global url."https://".insteadOf git://

再次执行npm install ,依然没有解决

使用以上方法,可能对于部分人来说,可以解决问题,但是我的依然存在问题。

方法三:

桌面右键,git bash here 输入以下 ssh-keygen -t rsa -C “[email protected]” 如下图

ssh-keygen -t rsa -C “[email protected]

然后打开C:\Users\你的用户\.ssh文件夹下会多出两个文件,id_rsa.pub和id_rsa,这个known_hosts文件是本来就有的,打开id_rsa.pub复制里面的全部内容。

然后用你上面填的邮箱登录github.com 如下图将复制的内容粘贴到Key的区域,然后Add SSH key就可以了。回去继续npm install

执行完以上操作后,再次执行npm install,发现这次安装成功了,那么再次执行以下指令:

npm run dev

此时项目启动起来了。

3、结果

以上博客参考于:https://www.cnblogs.com/lijinwei/p/16564298.html

学习之所以会想睡觉,是因为那是梦开始的地方。

ଘ(੭ˊᵕˋ)੭ (开心) ଘ(੭ˊᵕˋ)੭ (开心)ଘ(੭ˊᵕˋ)੭ (开心)ଘ(੭ˊᵕˋ)੭ (开心)ଘ(੭ˊᵕˋ)੭ (开心)

------不写代码不会凸的小刘

猜你喜欢

转载自blog.csdn.net/qq_40834643/article/details/128850270