R
Railwayβ€’9mo ago
slicksammy

Deploying create react app

Project id 4f0fc161-46d1-43d8-8755-ed4c3ba94e92 I'm trying to deploy a create-react-app project but the build fails. First it failed with "yarn run build" and then I set "npm run build" as the command and that also failed. These commands work fine locally.
Solution:
looks to me like eslint errors, you need to fix those to deploy your app if you don't want to bother fixing the errors then you can set CI to false in your service variables...
Jump to solution
16 Replies
Percy
Percyβ€’9mo ago
Project ID: 4f0fc161-46d1-43d8-8755-ed4c3ba94e92
Fragly
Fraglyβ€’9mo ago
slicksammy
slicksammyOPβ€’9mo ago
Dockerfile:24 ------------------- 22 | # build phase 23 | COPY . /app/. 24 | >>> RUN --mount=type=cache,id=s/8f9db790-14c3-4a96-81d3-4f4a2ac4805f-node_modules/cache,target=/app/node_modules/.cache npm run build 25 | 26 | ------------------- ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1 Its a static app
Fragly
Fraglyβ€’9mo ago
Mind downloading the logs using the link I gave you?
slicksammy
slicksammyOPβ€’9mo ago
I don't want to use that link bro, sorry. I don't know what it is and how it works I'll copy the entire logfile, one sec
slicksammy
slicksammyOPβ€’9mo ago
Solution
Fragly
Fraglyβ€’9mo ago
looks to me like eslint errors, you need to fix those to deploy your app if you don't want to bother fixing the errors then you can set CI to false in your service variables
slicksammy
slicksammyOPβ€’9mo ago
Thanks bud. I did not realize that eslint errors would prevent deploying, first time deploying SPA. Thank you!
Fragly
Fraglyβ€’9mo ago
No problem πŸ™‚
slicksammy
slicksammyOPβ€’9mo ago
Just one more quick question - for static SPA, am i supposed to deploy to Railway or use a static site service?
Fragly
Fraglyβ€’9mo ago
either could work, although I would personally use Railway ( definitely biased though )
Medim
Medimβ€’9mo ago
You can deploy to railway but u will need something to serve that static file
Fragly
Fraglyβ€’9mo ago
Nixpacks can actually serve static files, you just throw a Staticfile file in your project https://nixpacks.com/docs/providers/staticfile Although to be clear, for SPA apps like this one, you'd want to go to Brody's create-react-app-starter repo and copy the Caddyfile and nixpacks.toml file into yours
Medim
Medimβ€’9mo ago
#TheMoreYouKnow
slicksammy
slicksammyOPβ€’9mo ago
Thank you for sharing, I will check it out!
Dmitry
Dmitryβ€’9mo ago
If it's simply a static website.. i'd throw a CDN in front of Railway personally (like Cloudflare for example), but not necessary πŸ™‚
Want results from more Discord servers?
Add your server