#I have problems deploying my react app, can someone pls help me

1 messages · Page 1 of 1 (latest)

cloud sun
#

what are the specs on your vps?

tired warren
#

i use railway.app so i do not know

cloud sun
#

"scripts": {
"start": "react-scripts --max_old_space_size=4096 start",
"build": "react-scripts --max_old_space_size=4096 build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}

#

adjust your scripts for whatever memory is available to you

tired warren
#

i added this

#

i now get this error

#

The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process.
npm WARN config production Use --omit=dev instead.

cloud sun
#

you set way too much memory lol

#

adjust it to your environment

tired warren
#

how do i know how much memory i need hahaha, sorry this is the first time im deploying something

cloud sun
#

idk railway app so idk but try smaller and work your way up

#

you could try googling how much RAM they make available to you

tired warren
cloud sun
#

set it to like 400MB

#

maybe 300mb idk

#

depends on if your system resource usage counts or not

tired warren
#

im going to try this

#

hopefully it works

cloud sun
#

soo?

tired warren
#

yeah same error

cloud sun
#

what did yoou set the size to? 300?

tired warren
#

yeah 30

#

0

tired warren
# tired warren

i did that using the enviroment variables like you you see in this image

cloud sun
#

try putting it in your package json at like 225

#

idk

#

512MB isnt much if theyre counting system resources

tired warren
#

so you say, if i use this one

#

it will work

cloud sun
#

shouldnt need to lol

#

should work on 512mb will just be slow

tired warren
#

ow

#

i really do not understand the problem of this thing pfff

tired warren
#

can someone else pls help if possible

lusty spoke
#

out of memory

tired warren
#

how do i use less memory

#

like i said, this is just a simple landing page

safe finch
# tired warren like i said, this is just a simple landing page

Problem is not necessarily your code, it's the framework and dependencies being pulled in. If you're using boilerplate code for the app and you don't have unnecessary dependencies then you just need to make your environment bigger.

To start with, the memory spec of --max-old-space-size=4096 was 4GB, since this parameter is in megabytes, not bytes. So if you only have 512mb of ram you cannot expect to support a heap size beyond 384mb considering you need the actual VM to function.

If you have adjusted your memory and you still crash then you clearly need a bigger VM to operate within. And then adjust your heap size accordingly.

tired warren
safe finch
#

Try using smaller environment with lower heap size (384) and if it still fails to start then, yeah it probably just has too many dependencies or the webpack stage just needs more than that.

#

In which case 8gb should be plenty.

#

But set heap size accordingly!

tired warren
#

yeah already tried that didnt work

cloud sun
#

did you try with 256 or lower?

tired warren
#

yes

#

i tried 256

#

but i didnt go lower

#

just checked

#

i did go lower

#

i tried 200 en 256

#

both didnt work

cloud sun
tired warren
#

here you go

cloud sun
#

can you control what os its running on/do you know what it is?

tired warren
#

i do not know where i can find that information

lusty spoke
#

try alpine linux it uses less ram

#

otherwise try a php app 😄

safe finch
#

Have no idea about railway, I would just use lightsail on aws for something simple - or just deploy a t2-micro instance on EC2

lusty spoke
#

godaddy is cheap also but php normally