环境准备
安装git
yum install git
安装nodejs(npm)
CentOS
yum install -y npm
Debian
apt-get install nodejs
apt-get install npm
安装vue
npm install -g @vue/cli
下载 vue-element-admin
- 克隆项目
git clone https://github.com/PanJiaChen/vue-element-admin.git - 进入项目目录
cd vue-element-admin - 安装依赖
npm install
异常和报错
建议不要用 cnpm 安装 会有各种诡异的bug。 可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
如执行 npm install 报错:
npm ERR! Unexpected end of JSON input while parsing near '...emirror-3.24.0.tgz"}}'
可尝试如下解决方法:
- 删除 package-lock.json
rm package-lock.json
- 清除缓存 cache
npm cache clean --force
- 进入文件夹清除cache:C:/Users/Yourname/AppData/Roaming/npm-cache
- 取消使用淘宝镜像
npm set registry https://registry.npmjs.org/
如执行 npm install 报错:
npm ERR! code EINTEGRITY
npm ERR! sha512-pw4xScRPsLegD/cqEcoXRKeA2SD4+s+Kyo0Na166NamOWhzNl2yI5RZ2rE97tBlAopNmhyMeBVpAeD5qb+ee1A== integrity checksum failed when using sha512: wanted sha512-pw4xScRPsLegD/cqEcoXRKeA2SD4+s+Kyo0Na166NamOWhzNl2yI5RZ2rE97tBlAopNmhyMeBVpAeD5qb+ee1A== but got sha512-GYF//eqZQrx2UlD2nH6k4m0VMmgDKdl65UEhVnsVggIaUVJ5ok/K56Y7KmBg6bbEEZNcbk29L7nx4ykDR4emNw==. (6318535 bytes
执行:
npm cache verify
然后重新安装:
npm install
......
found 7 vulnerabilities (5 low, 2 high)
run `npm audit fix` to fix them, or `npm audit` for details
执行:
npm audit fix
本地开发 启动项目
npm run dev
vue-element-admin https://panjiachen.gitee.io/vue-element-admin-site/zh/guide/#%E5%AE%89%E8%A3%85
解决npm ERR! Unexpected end of JSON input while parsing near https://blog.csdn.net/weixin_38483133/article/details/104655076
npm ERR! code EINTEGRITY 解决方案 https://blog.csdn.net/Maxiao1204/article/details/95374365