vue-cli3项目搭建完成之后执行 npm run serve报错,
> vue-cli-service serve
sh: vue-cli-service: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! XXX-es6@0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the cp3-es6@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /Usereng/.npm/_logs/2020-01-31T14_17_58_922Z-debug.log
此问题解决办法如下:
第一步,删除该项目中的“node_modules”文件夹
第二步,使用cnpm install安装依赖包
第三步,依赖包安装完成之后执行 npm run serve就可以运行啦!
希望能帮到您!点个赞呗!