Search code examples
reactjswebpackcreate-react-appreact-scripts

How can be fixed react-scripts build error?


I'm trying to build react-application(create-app-react based) for production using react-scripts, but I'm getting error on npm run build:

Creating an optimized production build...Completed in 69ms
/var/www/html/test_project/node_modules/react-scripts/scripts/build.js:19
  throw err;
  ^

RpcIpcMessagePortClosedError: Process 701148 exited [SIGKILL].
    at /var/www/html/test_project/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:19:23
    at Generator.next (<anonymous>)
    at /var/www/html/test_project/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/var/www/html/test_project/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:4:12)
    at ChildProcess.handleExit (/var/www/html/test_project/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:18:42)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12) {
  code: null,
  signal: 'SIGKILL'

I'm using node-js v14.19.3 and npm 8.12.1

--verbose mode didnt provide any useful details in logs. Maybe somebody had such cases. How this error can be fixed?


Solution

  • Hitting the same problem currently

    The problem is a lack of memory. That results in undefined behavour of fork-ts-checker-webpack-plugin. Here in the related discussion they mention memory limit for npm.

    @Keavon Did you try increase the memory limit in the config?

    That just made me to check that. The propblem is my virtual server's having 1Gb of operating memory. This is just not enought for running build.

    You may check your memory consumption using top

    before running build:

    before running build

    in the proccess of running build:

    while running build