Perhaps 75-80% of the time, I can run git pull
on my EC2 Linux server, then npm run build
to create a production-ready build of my React app. On occasion, however, after running npm run build
, the whole server freezes and I have to force restart several times just to get it up and running again.
It seems to be entirely random. It seems awfully bizarre some JavaScript compilation (I guess?) process can knock over an entire server, but it happens frequently enough that it's obviously not caused by anything else.
Is this something anyone's encountered?
All this depends on the configuration of your server instance. Actually build process take a lot of processor power and memory ,so the server might reach out of memory while building.
You can consider upgrading your server Or one temporary solution for it can be that you can build the react app on your local machine and simply serve that build folder through the server.
Build process in resource consuming, and this is exepected. This is why in my deploy pipelines often I launch the build locally before deploy (it takes about 6 minutes on some apps, depending on complexity and webpack configuration), or I setup another server that is only used for build process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With