报错原因
sh: vue-cli-service: command not found
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! mall@0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the mall@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
解决方法
终端执行命令即可
# 清除缓冲
npm cache clean --force
# 重新安装
npm/cnpm install
其他方案
另外根据网上的文章,还有以下几个解决方案:
1. 重新安装
将文件夹node_modules 删除后执行 npm/cnpm install 进行重新安装。
2. 指定路径
./node_modules/.bin/vue-cli-service build\
3. 全局安装
npm/cnpm install @vue/cli-service -g
如果是其他原因可以参考Stack Overflow。