question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

write EPIPE error in when doing production build in docker

See original GitHub issue

Hi there, I’ve got FE in docker container and running build there ends with following error from time to time. Anyone got idea what’s causing it?

syscall: 'write'
code: 'EPIPE',
errno: 'EPIPE',
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
at internal/child_process.js:810:39
Emitted 'error' event on ChildProcess instance at:
at /frontend/node_modules/terser-webpack-plugin/dist/TaskRunner.js:113:86
at enqueue (/frontend/node_modules/terser-webpack-plugin/dist/TaskRunner.js:89:35)
at TaskRunner.runTask (/frontend/node_modules/terser-webpack-plugin/dist/TaskRunner.js:41:26)
at JestWorker._callFunctionWithArgs (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/index.js:178:23)
at Farm.doWork (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:56:12)
at new Promise ()
at /frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:90:14
at Farm._push (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:159:12)
at Farm._enqueue (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:152:10)
at Farm._process (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:129:10)
at WorkerPool.send (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/WorkerPool.js:32:34)
at ChildProcessWorker.send (/frontend/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/workers/ChildProcessWorker.js:330:17)
at ChildProcess.target.send (internal/child_process.js:677:19)
at ChildProcess.target._send (internal/child_process.js:806:20)
Error: write EPIPE
^
throw er; // Unhandled 'error' event

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

4reactions
elmar-de-grootcommented, Mar 8, 2021

I ran into a very simular problem where yarn build worked just fine on my local machine, but when running the same command inside a docker build . command, i received EPIPE errors simular to above. My issue was relatively easy to solve by creating a .dockerignore file to prevent copying of the node_modules on the local machine onto the docker image, like so:

// file  .dockerignore
node_modules
dist
// file: dockerfile
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build

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

Hope this helps someone else.

1reaction
bfrazcommented, Jun 13, 2020

may be an issue with memory. Add a memory constraint to node, e.g. --max-old-space-size=1024. The flag can be added a number of ways, i.e. .npmrc, NODE_OPTIONS env variable, etc

Read more comments on GitHub >

github_iconTop Results From Across the Web

80% of the time build fails with Error: write EPIPE error
Hi, I keep getting this error when using v4.0.0: Module build failed: Error: write EPIPE at _errnoException (util.js:1031:13) at WriteWrap.
Read more >
Docker Node.js EPIPE error - remarkablemark
I discovered this was caused by not allocating enough Memory and Swap in Docker Desktop > Settings > Resources > Advanced. Once I...
Read more >
Webpack Build Fails with EPIPE error (Linux Subsystem only)
I have a project that compiles just fine if I run Webpack from command line using the windows version of the installed ...
Read more >
UNHANDLED EXCEPTION write EPIP with Gatsby build
The site builds without errors locally, but when I try to deploy to netlify, it fails with an error msg. “error UNHANDLED EXCEPTION...
Read more >
Build your Node image - Docker Documentation
Learn how to build your first Docker image by writing a Dockerfile. ... first thing you do once you've downloaded a project written...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found