以报错为以下信息为例:
Error: listen EADDRINUSE: address already in use 127.0.0.1:8888
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cli-3.0@0.1.0 build: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cli-3.0@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
解决方法:
1.打开cmd
2.输入netstat -ano,会弹出下图
3.输入 tskill 59568 (59568 对应上边报错的 127.0.0.1:8888)
个人发现是因为打包以后没有结束进程占用了端口号,如果ctrl c-》y结束进程以后再运行就不会出现这个问题。