Create-react-app: Build script exits improperly on build error

Created on 21 Feb 2020  路  4Comments  路  Source: facebook/create-react-app

Describe the bug

We had an issue where building the app using yarn build would hang indefinitely if the build failed. I wasn't able to reproduce in a demo environment, but we were able to fix the issue by ejecting and fixing the build.js script itself:

In a number of places in build.js, there's a call to:
process.exit(1);

With our app this caused the hang. We replaced it with:
process.exitCode = 1;

This seemed to resolve the issue. As per official node documentation:

In most situations, it is not actually necessary to call process.exit() explicitly. The Node.js process will exit on its own if there is no additional work pending in the event loop. The process.exitCode property can be set to tell the process which exit code to use when the process exits gracefully

bug report needs triage stale

Most helpful comment

Add .env with "SKIP_PREFLIGHT_CHECK=true"

All 4 comments

Add .env with "SKIP_PREFLIGHT_CHECK=true"

Thanks @Aakashdeveloper

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings