问题描述:

下载完项目打算用npm run serve 进行跑程序的时候出现一下报错

(base) MacBook-Pro sinopec-front-end-web-master % npm run serve
> sinopec_web@0.1.0 serve /Users/xxx
> 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! sinopec_web@0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the sinopec_web@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!     /Users/xxxx

原因分析:

出现以上报错,是因为缺少node_modules的文件,有一些人会觉得node_modules这个文件太大了,且实用性不强,就没有上传。

解决方案:

在命令行中先进入该文件的路径,然后在输入
npm install

就会下载node_modules文件
下载完成后,就可以 npm run serve 运行项目了

Logo

前往低代码交流专区

更多推荐