本人历时两天 翻阅各种书籍 资料 躺过无数次坑 最终终于成功启动 由此记录一下
1,克隆项目 可以用gitee上的地址 下载速度快 gitee.com/panjiachen/…
2,按照官方要求 #进入项目目录 cd vue-element-admi **
3, #安装依赖 建议不要用 cnpm 安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题 npm install --registry=registry.npm.taobao.org**
这时问题就来了 依赖安装不上很大概率是node-sass安装失败
1,下载pythone2.x 配置pytnone环境
2,项目根目录下添加了一个.npmrc
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org
3,下载sass-loader和node-sass模块
1、npm install sass-loader --save-dev
2、npm install node-sass --save-dev
4,把node-sass的路径修改成淘宝的npm 用国内网下载
npm install --registry=https://registry.npm.taobao.org
5,启动项目 npm run dev
注:如果报以下错误
vue-element-admin@4.4.0 dev /mnt/d/h5/vue-element-admin
vue-cli-service serve
INFO Starting development server…
98% after emitting CopyPlugin
DONE Compiled successfully in 18824ms 3:47:42 PM
App running at:
Local: http://localhost:9527/
Network: unavailable
Note that the development build is not optimized.
To create a production build, run npm run build.
events.js:287
throw er; // Unhandled ‘error’ event
^
Error: spawn cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted ‘error’ event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: ‘ENOENT’,
code: ‘ENOENT’,
syscall: ‘spawn cmd.exe’,
path: ‘cmd.exe’,
spawnargs: [ ‘/c’, ‘start’, ‘""’, ‘/b’, ‘http://localhost:9527/’ ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-element-admin@4.4.0 dev: vue-cli-service serve
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-element-admin@4.4.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-24T07_47_42_933Z-debug.log`
解决方案
1,系统环境变量的path中添加C:\windows\system32
2,vue.config.js 中 open:true 注释掉或者 改成false,运行完程序后,不自动启动浏览器。
然后再重新npm run dev
总结 :需要工具 node.js git python2.x webpack3以上 npm 具体环境变量配置我会在下方留言截图 如果有任何其他问题都可以留言
码字不易 转载请标明出处