'React Build with Jenkins - ERROR: "build-js" exited with 1
I'm currently migrating my local Jenkins to a new EC2 instance and in transferring the UI build pipeline, I currently am getting the following error during build:
ERROR: "build-js" exited with 1.
I had received this previously on the current Jenkins server, however, it was resolved by doing the following:
react-app-rewired --max_old_space_size=4096 build
Server / build details:
t3.large - 2 vCPU and 8gb Ram
Amazon Linux - 64bit x86
Node 16.14.0
I have tried multiple options with the build, however, none of them appear to want to work. The max-old-space doesn't even seem to be doing anything. Not even sure what other options are available.
Solution 1:[1]
Try to build your react app with CI flag set to false
"scripts": {
"build": "CI=false && react-scripts build",
}
If this doesnt work then try directly change the flag
CI=false react-scripts run build
*react-scripts needs to be replaced depending on wht you use
Solution 2:[2]
The --max_old_space_size indicate how much memory your build process can use, try make it bigger:
react-app-rewired --max_old_space_size=8192 build
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Damian Busz |
| Solution 2 | Zheng Bowen |
