Repository: create-react-app
Issue: write EPIPE error on production building
Labels: needs triage



- package.json like below

```
{
    "name": "x2",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@ant-design/charts": "^1.2.14",
        "@ant-design/icons": "latest",
        "ahooks": "^2.10.12",
        "antd": "^4.17.1",
        "antd-img-crop": "^3.16.0",
        "axios": "^0.21.1",
        "classnames": "^2.3.1",
        "compressorjs": "^1.0.6",
        "dayjs": "^1.10.5",
        "decimal.js-light": "^2.5.1",
        "file-saver": "^2.0.2",
        "immer": "^9.0.0",
        "immutability-helper": "^3.1.1",
        "less": "^4.1.0",
        "lodash": "^4.17.20",
        "prop-types": "^15.7.2",
        "qrcode.react": "^1.0.0",
        "react": "^16.14.0",
        "react-color": "^2.19.3",
        "react-copy-to-clipboard": "^5.0.2",
        "react-dnd": "^11.1.3",
        "react-dnd-html5-backend": "^11.1.3",
        "react-document-title": "^2.0.3",
        "react-dom": "^16.14.0",
        "react-hot-keys": "^2.7.1",
        "react-loadable": "^5.5.0",
        "react-resizable": "^1.11.0",
        "react-router": "^5.2.0",
        "react-router-dom": "^5.2.0",
        "react-scripts": "3.4.3",
        "react-use": "^17.3.1",
        "react-webcam": "^5.2.1",
        "store": "^2.0.12",
        "use-immer": "^0.6.0",
        "wolfy87-eventemitter": "^5.2.9"
    },
    "scripts": {
        "analyze": "source-map-explorer build/static/js/*.js",
        "build-css": "node-less-chokidar src",
        "watch-css": "npm run build-css && node-less-chokidar src --watch --recursive",
        "start-js": "react-app-rewired start",
        "start": "npm-run-all -p watch-css start-js",
        "build-js": "react-app-rewired --max_old_space_size=8192 build",
        "build": "npm-run-all build-css build-js",
        "test": "react-app-rewired test --env=jsdom",
        "eject": "react-scripts eject"
    },
    "husky": {
        "hooks": {
            "pre-commit": "lint-staged"
        }
    },
    "devDependencies": {
        "@ant-design/compatible": "^1.0.8",
        "antd-dayjs-webpack-plugin": "^1.0.6",
        "babel-plugin-import": "^1.13.1",
        "babel-preset-latest": "^6.24.1",
        "customize-cra": "^1.0.0",
        "eslint-plugin-react": "^7.21.4",
        "eslint-plugin-react-hooks": "^4.1.2",
        "http-proxy-middleware": "^2.0.0",
        "husky": "^5.2.0",
        "less-loader": "^7.0.2",
        "lint-staged": "^10.4.0",
        "node-less-chokidar": "^0.4.1",
        "npm-run-all": "^4.1.5",
        "path-to-regexp": "^6.2.0",
        "prettier": "^2.2.1",
        "progress-bar-webpack-plugin": "^2.1.0",
        "react-app-rewired": "^2.1.8",
        "react-data-grid": "^6.1.0",
        "source-map-explorer": "^2.5.0"
    },
    "browserslist": [
        ">0.2%",
        "not dead",
        "not ie <= 11",
        "not op_mini all"
    ]
}


```
```

Creating an optimized production build...
[21:00:42] freemem: 15470.6015625
[21:00:42] cpus: 16
[21:08:22] events.js:292
[21:08:22]       throw er; // Unhandled 'error' event
[21:08:22]       ^
[21:08:22] 
[21:08:22] Error: write EPIPE
[21:08:22]     at ChildProcess.target._send (internal/child_process.js:806:20)
[21:08:22]     at ChildProcess.target.send (internal/child_process.js:677:19)
[21:08:22]     at ChildProcessWorker.send (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/workers/ChildProcessWorker.js:291:17)
[21:08:22]     at WorkerPool.send (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/WorkerPool.js:32:34)
[21:08:22]     at Farm._process (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/Farm.js:129:10)
[21:08:22]     at Farm._enqueue (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/Farm.js:152:10)
[21:08:22]     at Farm._push (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/Farm.js:159:12)
[21:08:22]     at /root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/Farm.js:90:14
[21:08:22]     at new Promise (<anonymous>)
[21:08:22]     at Farm.doWork (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/Farm.js:56:12)
[21:08:22]     at JestWorker._callFunctionWithArgs (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_jest-worker@25.5.0@jest-worker/build/index.js:143:23)
[21:08:22]     at TaskRunner.runTask (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_terser-webpack-plugin@2.3.8@terser-webpack-plugin/dist/TaskRunner.js:41:26)
[21:08:22]     at enqueue (/root/workspace/the-new-retail_retail-platform_A427/node_modules/_terser-webpack-plugin@2.3.8@terser-webpack-plugin/dist/TaskRunner.js:89:35)
[21:08:22]     at /root/workspace/the-new-retail_retail-platform_A427/node_modules/_terser-webpack-plugin@2.3.8@terser-webpack-plugin/dist/TaskRunner.js:113:86
[21:08:22] Emitted 'error' event on ChildProcess instance at:
[21:08:22]     at internal/child_process.js:810:39
[21:08:22]     at processTicksAndRejections (internal/process/task_queues.js:79:11) {
[21:08:22]   errno: 'EPIPE',
[21:08:22]   code: 'EPIPE',
[21:08:22]   syscall: 'write'
[21:08:22] }
[21:08:23] npm info lifecycle retail-platform@0.1.0~build-js: Failed to exec build-js script
[21:08:23] npm ERR! code ELIFECYCLE
[21:08:23] npm ERR! errno 1
[21:08:23] npm ERR! retail-platform@0.1.0 build-js: `react-app-rewired --max_old_space_size=8192 build`
[21:08:23] npm ERR! Exit status 1
[21:08:23] npm ERR! 
[21:08:23] npm ERR! Failed at the retail-platform@0.1.0 build-js script.
[21:08:23] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[21:08:23] npm timing npm Completed in 462277ms
[21:08:23] 
[21:08:23] npm ERR! A complete log of this run can be found in:
[21:08:23] npm ERR!     /root/.npm/.npm_cache/_logs/2021-12-10T13_08_23_232Z-debug.log
[21:08:23] ERROR: "build-js" exited with 1.
[21:08:23] npm info lifecycle retail-platform@0.1.0~build: Failed to exec build script
[21:08:23] npm ERR! code ELIFECYCLE
[21:08:23] npm ERR! errno 1
[21:08:23] npm ERR! retail-platform@0.1.0 build: `npm-run-all build-css build-js`
[21:08:23] npm ERR! Exit status 1
[21:08:23] npm ERR! 
[21:08:23] npm ERR! Failed at the retail-platform@0.1.0 build script.
[21:08:23] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[21:08:23] npm timing npm Completed in 463397ms
[21:08:23] 
[21:08:23] npm ERR! A complete log of this run can be found in:
[21:08:23] npm ERR!     /root/.npm/.npm_cache/_logs/2021-12-10T13_08_23_284Z-debug.log
[21:08:23] [ERROR] BUILD ERROR
[21:08:23] [ERROR] 36020437
[21:08:23] [ERROR] 1

```