Docker 构建 vue 项目失败: vue-cli-service: not found 作者: Chuwen 时间: 2021-12-28 分类: Docker 报错内容: ``` => ERROR [project_nginx frontend 7/7] RUN npm run build 0.6s ------ > [project_nginx frontend 7/7] RUN npm run build: #34 0.523 #34 0.523 > project-web@0.1.0 build /app #34 0.523 > vue-cli-service build #34 0.523 #34 0.528 sh: vue-cli-service: not found #34 0.534 npm ERR! code ELIFECYCLE #34 0.534 npm ERR! syscall spawn #34 0.534 npm ERR! file sh #34 0.535 npm ERR! errno ENOENT #34 0.537 npm ERR! project-web@0.1.0 build: `vue-cli-service build` #34 0.538 npm ERR! spawn ENOENT #34 0.538 npm ERR! #34 0.538 npm ERR! Failed at the project-web@0.1.0 build script. #34 0.538 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. #34 0.542 #34 0.542 npm ERR! A complete log of this run can be found in: #34 0.542 npm ERR! /root/.npm/_logs/2021-12-28T02_12_13_429Z-debug.log ------ failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm run build]: exit code: 1 ``` 找到相关的问题:https://github.com/vuejs/vue-cli/issues/5107 解决办法,从你的 Dockerfile 把这行 `ENV NODE_ENV production` 去除就可以了 标签: Docker