Angular build in docker fails [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

  angular, docker, javascript, node.js, npm

I have the following docker file to build an angular project

FROM node:12-buster-slim  as build-step
RUN mkdir -p /app
COPY . /app
WORKDIR /app
RUN chmod 777 -R /app
RUN npm install
ARG configuration=production
RUN npm run build -- --output-path=./dist/out --configuration $configuration
FROM nginx:alpine
COPY --from=build-step /app/build/out/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/default.conf
EXPOSE 80

The build stage fails with the following error

#15 80.97 /app/node_modules/esbuild/bin/esbuild: 2: /app/node_modules/esbuild/bin/esbuild: Cy�: not found
#15 80.97 /app/node_modules/esbuild/bin/esbuild: 3: /app/node_modules/esbuild/bin/esbuild: Syntax error: word unexpected (expecting ")")
#15 84.20 ✔ Browser application bundle generation complete.
#15 84.21 ✔ Browser application bundle generation complete.
#15 84.23 
#15 84.23 /app/src/@fuse/components/alert/alert.component.scss - Error: /app/src/@fuse/components/alert/alert.component.scss from Css Minimizer
#15 84.23 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
#15 84.23     at doWrite (_stream_writable.js:399:19)
#15 84.23     at writeOrBuffer (_stream_writable.js:387:5)
#15 84.23     at Socket.Writable.write (_stream_writable.js:318:11)
#15 84.23     at Object.writeToStdin (/app/node_modules/esbuild/lib/main.js:1723:19)
#15 84.23     at sendRequest (/app/node_modules/esbuild/lib/main.js:617:14)
#15 84.23     at start (/app/node_modules/esbuild/lib/main.js:1292:9)
#15 84.23     at Object.transform2 [as transform] (/app/node_modules/esbuild/lib/main.js:1302:5)
#15 84.23     at /app/node_modules/esbuild/lib/main.js:1779:55
#15 84.23     at new Promise (<anonymous>)
#15 84.23     at Object.transform (/app/node_modules/esbuild/lib/main.js:1779:14)
#15 84.23 
#15 84.23 /app/src/@fuse/components/card/card.component.scss - Error: /app/src/@fuse/components/card/card.component.scss from Css Minimizer
#15 84.23 Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
#15 84.23     at doWrite (_stream_writable.js:399:19)
#15 84.23     at writeOrBuffer (_stream_writable.js:387:5)
#15 84.23     at Socket.Writable.write (_stream_writable.js:318:11)
#15 84.23     at Object.writeToStdin (/app/node_modules/esbuild/lib/main.js:1723:19)
#15 84.23     at sendRequest (/app/node_modules/esbuild/lib/main.js:617:14)
#15 84.23     at start (/app/node_modules/esbuild/lib/main.js:1292:9)
#15 84.23     at Object.transform2 [as transform] (/app/node_modules/esbuild/lib/main.js:1302:5)
#15 84.23     at /app/node_modules/esbuild/lib/main.js:1779:55
#15 84.23     at new Promise (<anonymous>)
#15 84.23     at Object.transform (/app/node_modules/esbuild/lib/main.js:1779:14)

Any ideas?

Source: Docker Questions

LEAVE A COMMENT