create-react-app: Production Build Randomly Fails
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
Yes.
Description
The html file build randomly fails, leading to a missing HTML file. This happens silently and intermittently.
Repro instructions:
- Delete the
build/
contents between runs - Run build
- Make sure
build/index.html
got generated – ifbuild/index.html
is missing, you’ve reproduced the bug - Repeat
Expected behavior
HTML file should always build.
Actual behavior
Building from scratch, build/index.html
intermittently fails to get generated.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): N/A - I have ejectednode -v
: v6.9.1npm -v
: 4.0.2create-react-app --version
: 0.6.0
Then, specify:
- Operating system: Ubuntu 16.04.1 LTS
- Browser and version: N/A
Reproducible Demo
Run create-react-app
with defaults and you’ll have it, but you may have to run build a lot to repro the problem.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 22 (7 by maintainers)
We’ll need to figure out which part of the build is so memory hungry.
I’ve seen silent failures in
npm run build
due to out-of-memory conditions on machines with no swap space. Next time this happens, check your system logs (see my comment in #1133)Hi!
react-scripts
v0.9.0 was just released which should show you an error message when this happens; presumably your machine is running out of memory.Please let us know if this prompts you, thanks!
Reproduced this error on ec2 t2 micro. The only file generated was the favicon 😂.
I mitigated by adding swap space and the build worked out fine. thanks @godmar
This is very likely the same issue. I’m trying to run the build on an SSD cloud server, possibly with little or no swap space configured. I’ll look into this. Thank you @godmar.