Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Angular12 Dockerization esbuild issue

I am trying to Dockerize my Angular12 app. I am able to Dockerize it fine when building using development as the environment. However, when building as production (production as default build and ng serve environment) I am getting some esbuild error on the npm run build section of the Dockerfile.

Here is the error log (the .... after MZ was some special undecipherable characters originally) :

#15 1.112 > ng build
#15 1.112
#15 4.377 - Generating browser application bundles (phase: setup)...
#15 17.18 /app/node_modules/@angular-devkit/build-angular/node_modules/esbuild/esbuild.exe: 1: /app/node_modules/@angular-devkit/build-angular/node_modules/esbuild/esbuild.exe: MZ....: not found
#15 17.18 /app/node_modules/@angular-devkit/build-angular/node_modules/esbuild/esbuild.exe: 3: /app/node_modules/@angular-devkit/build-angular/node_modules/esbuild/esbuild.exe: Syntax error: end of file unexpected (expecting ")")

Here is the Dockerfile:

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

FROM nginx:1.20.1
COPY --from=build-step /app/dist/my-app /usr/share/nginx/html
EXPOSE 4200:80
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If your application folder contains node_modules, try deleting it before starting the Dockerfile build, or exclude it from being copied into the container.

The reason it might fail is that the esbuild binary is environmentally dependent and the one that you use for your local environment may not necessarily work with the docker image.

Source: I had similar issue with building an application locally on my Macbook when it was working fine on my server.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!