I tried setting up a ReactJS app with create-react-app
on my DigitalOcean Droplet with 10 GB disk space and 512 MB RAM (Ubuntu 22.04), though it keeps failing on react-scripts
. When I do it on my much better equipped local machine (also Ubuntu), it works fine. Any idea what might cause this?
Asked
Active
Viewed 147 times
-1
2 Answers
1
It might be due to the available RAM. Following what was tried in this answer:
node --max_old_space_size=512 node_modules/.bin/react-scripts build

Luciano
- 354
- 1
- 7
-
Is there a way of specifying this for create-react-app? Because I don’t want to do it manually – naraghi Jan 16 '23 at 06:51
-
Try "build": "react-scripts --max-old-space-size=512 build" in your package.json. – Luciano Jan 16 '23 at 07:38
-
Alright, but there is no package.json before executing create-react-app. Should I just run npm init? – naraghi Jan 16 '23 at 07:51
-
Hmm, no. The idea is to have the json and files generated by create-react-app. One workaround I can think of is running create-react-app on your local, changing the build command over there, push everything into a remote repo and simply clone it in the server. – Luciano Jan 16 '23 at 07:58
-
Yeah I thought about that, too, but wasn't sure if create-react-app does anything outside the folder, like edit some configuration with a wider scope – naraghi Jan 16 '23 at 09:00
-
But if all create-react-app does is generate the directory and file structure, then I may as well edit the build command on the remote machine, too, right? – naraghi Jan 16 '23 at 09:06
1
export NODE_OPTIONS=--max_old_space_size=512
npx create-react-app my-app

Gabor Dolla
- 2,680
- 4
- 14
- 13