leonms
leonms

Reputation: 103

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

I want to dockerise my angular application, but I get the following error while building the Dockerfile.

My 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;"]

Error log:

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

Upvotes: 2

Views: 10408

Answers (2)

SoyonL
SoyonL

Reputation: 1

I've seen the same error message when I dockerise a web app served in Parcel. In my case, my package.json simply didn't have build script.

Upvotes: 0

JTBJ
JTBJ

Reputation: 31

I've faced a similar issue, but it was faced completing the Java guide in the Docker documentation. Originally, I was having this issue while working in the Intellij terminal and also from the Windows CLI. Even after completing the steps from the link provided at the end of this comment, the Intellij terminal would not do the job. I noticed two error codes; exit code: 1 & exit code: 127. Both referred to a "no such file or directory" error. I fixed the issue in the Visual Studio Code terminal by completing the step at the following link. Now my Docker image, builds using the docker build --tag java-docker . command, even in Intellij. Please reference the following link please click here

Upvotes: 3

Related Questions