情况:

日常 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\node_cache\_logs\2021-04-01T12_59_52_414Z-debug.log
PS F:\MyVue\program1\day07\demo> npm run dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR!     F:\Nodejs\node_cache\_logs\2021-04-01T13_00_43_138Z-debug.log
PS F:\MyVue\program1\day07\demo> vue init webpack

解决方法:

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

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

前往低代码交流专区

更多推荐