情况:

日常 cnpm run serve,突然报错

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! Failed at the demo@0.1.0 serve 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!     F:Nodejs
ode_cache_logs2021-04-01T12_59_52_414Z-debug.log
PS F:MyVueprogram1day07demo> npm run dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR!     F:Nodejs
ode_cache_logs2021-04-01T13_00_43_138Z-debug.log
PS F:MyVueprogram1day07demo> vue init webpack

解决方法:

懒得想了肯定是依赖的问题,打算直接暴力复原(其实对项目没啥影响,不用担心少了啥,因为源文件根本没去动)

1.把项目里的node_modules,也就是依赖包删掉
2.在终端运行cnpm install,重新安装依赖
3.终端运行cnpm run serve
然后?然后就再次进入到日复一日的code环节
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐