首页 > 解决方案 > Docker构建错误:执行程序运行失败[/bin/sh -c npm run build]:退出代码:1

问题描述

我想对我的 Angular 应用程序进行 dockerise,但是在构建 Dockerfile 时出现以下错误。

我的 Dockerfile:

FROM node:alpine as build-step
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
RUN npm run build

FROM nginx:alpine as prod-stage
COPY --from=build-step /app/dist/angular-app /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

错误日志:

executor failed running [/bin/sh -c npm run build]: exit code: 1

标签: angulardockerdockerfile

解决方案


推荐阅读