欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

执行npm run serve命令报错npm ERR! serve: `vue-cli-service serve`

程序员文章站 2022-05-13 20:02:51
...

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! [email protected] serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] 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就可以运行啦!

希望能帮到您!点个赞呗!