Lucas Bernalte
Lucas Bernalte

Reputation: 1377

events.js:288 Error: write EPIPE when executing tests with Jest

I have a problem when setting React Testing Library into a new project, which is a project that generates common UI components for several projects. In one of the projects it is correctly setup, but when I added React Testing Library and updated dependencies in this project, I am able to run a test but not all of them.

If I do yarn test this is the result:

Test Suites: 8 passed, 8 of 33 total
Tests:       84 passed, 84 total
Snapshots:   0 total
Time:        28 sevents.js:288
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at ChildProcess.target._send (internal/child_process.js:806:20)
    at ChildProcess.target.send (internal/child_process.js:677:19)
    at ChildProcessWorker.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\workers\ChildProcessWorker.js:291:17)
    at WorkerPool.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\WorkerPool.js:32:34)
    at Farm._process (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:129:10)
    at Farm._enqueue (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:152:10)
    at Farm._push (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:159:12)
    at C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:90:14
    at new Promise (<anonymous>)
    at Farm.doWork (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:56:12)
Emitted 'error' event on ChildProcess instance at:
    at internal/child_process.js:810:39
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  errno: 'EPIPE',
  code: 'EPIPE',
  syscall: 'write'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried doing rm -rf node_modules and then cleaning cache, and didn't work.

Any help?

Upvotes: 7

Views: 8424

Answers (4)

Gitaram Kanawade
Gitaram Kanawade

Reputation: 351

I was facing same issue with react 18, Nodejs 18 and react script 4.x

I just upgraded react script from 4.x to 5.x

it works

Upvotes: 0

Nacho
Nacho

Reputation: 388

In my case was the version of node. I had the version 15 (from Latest Features) and changed it to the stable version 14.17.3 (from LTS).

To know which version you have use node -v in a terminal.

Upvotes: 0

Marfin. F
Marfin. F

Reputation: 512

By doing yarn cache clean solved my problem. If you met pipe error similar like image below. I believe it is related to memory leaks.

enter image description here

Upvotes: 3

Lucas Bernalte
Lucas Bernalte

Reputation: 1377

It turns out that by changing some libraries in package.json the error dissapears:

Before (KO):

"babel-jest": "^24.9.0",
"jest": "^26.0.1",

After (OK):

"babel-jest": "^26.0.1",
"jest": "^25.5.4",

Upvotes: 3

Related Questions