Search code examples
npmcreate-react-appubuntu-18.04

Deploying React app on Ubuntu 18.04: build failed because process exited too early


I'm trying to deploy my React app on an Ubuntu 18.04 virtual machine provided by Digital Ocean. Here's my process: I have a git repo linked to the correct directory so all I need to do is a git pull followed by a 'npm run build'. Up until now, this has worked well enough and I could check the site on [my_domain]:8080, which is sufficient for now since I'm still in production.

However, when I tried to run 'npm run build' yesterday, I got this error:

screenshot of terminal

I've looked it up a bit but there's so many different possibilities that it's just confusing me more. The most common issue seems to be a lack of memory on the system, but judging by the data I get when I start up the terminal, this can't be the case.

screenshot of terminal

I have no clue how to proceed but I've also honestly just been starting to use DigitalOcean or Ubuntu for half a year and this is my first React app, so I would very much appreciate an explanation like I'm five ;)

Thanks so much!


Solution

  • The problem was apparently in the amount of RAM I had available. Solution: memory swapping. I followed this tutorial and after doing all this, the problem resolved itself.

    https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04