React app deployment issues
Hey all,
using ci/cd I deployed my React app but getting errors (failed deployment).
this is the error:
the app is React, so it's a Node app, why does it require python3.10?
how can I fix this issue?
and this is the package.json content attached
thanks
39 Replies
Project ID:
bb25496b-1a53-4b7d-a1c6-1ff5c4c025bb
bb25496b-1a53-4b7d-a1c6-1ff5c4c025bb
Hi!
Just to be clear, can you share what setup is railway trying to use? (it's that small table in the first lines of the Deploy log)
To me it looks like it autodetects the wrong provider
please use this to send your build logs https://bookmarklets.up.railway.app/log-downloader/
@maddsua
[Region: us-west1]
==============
Using Nixpacks
==============
context: 3b47e39ba0d248de10ac14cc8d70e062
╔══════════════ Nixpacks v1.19.0 ═════════════╗
║ setup │ nodejs_14, yarn-1_x ║
║─────────────────────────────────────────────║
║ install │ yarn install --frozen-lockfile ║
║─────────────────────────────────────────────║
║ build │ yarn run build ║
║─────────────────────────────────────────────║
║ start │ yarn run start ║
╚═════════════════════════════════════════════╝
^
but node 14 is not supported anymore, please use node 18
ok
same with Node 18
can you share your repo?
yup. give your github email or username
brody192
sent
i am on the staging branch
@Hatim what version of node and npm are you using locally?
I have just forced replaced the code to the latest running commit on 2022,
node -v
v16.13.0
npm -v
8.1.0
are you able to build the code in staging locally?
i thin it works on Node 18 only... let me double check
here what i did:
i updated the staging code
node 16 and npm 8 works locally fine but when i deploy it fails
node 18 shows conflicts with webpack version
you where able to build your site locally with node 16?
yes
can you send me a link to the repo again?
https://github.com/hatimmakki/hatim-blog-client/
"node": "16.20.2",
"npm": "10.2.5"
this works locally only
please pull the latest code
do you use yarn or npm when building locally?
npm
and now your local version of node is 16.20.2?
yes
deployed for you?
i used a dockerfile but yeah, im seeing a 400 error on an api request, but thats something youd need to fix in your code
otherwise, does that look fine?
copy these two files into your staging branch and deploy from that branch, thats all i did
oh i can modify Docker? that's great
you can put a Dockerfile in your repo and railway will build with that, I wouldn't call that modifying docker
but give those a try and let me know how it goes
ok, thanks... will railway run the build command as in the project settings?
because i don't see any build commands in the Dockerfile
oh sorry
found it
the dockerfile handles it all, please don't set any build or start commands yourself anywhere
Hi..
I realised the environmental variables from the project's "variables" tab are not used by this deployment. any idea how can I use that variables in the code?
yes I do, sorry for not mentioning it. so first all your variables would need to be prefixed with
REACT_APP_
though I'm sure they already are, then in the dockerfile you need to reference them to bring them into the build stage.
if you had a variable named REACT_APP_BACKEND_URL
for example, you would need to add a line with ARG REACT_APP_BACKEND_URL
under the first FROM
directive in the dockerfile, and so on for all the variables your app needs, heres an example https://docs.railway.app/guides/dockerfiles#using-variables-at-build-timeso, in this example, with only 1 line under FROM, will bring the env variable from Railway to this project? so i can access it using process.env.REACT_APP_BACKEND_URL
correct, you just continue adding lines with
ARG
for all variables needed
you dont need to put them here https://github.com/hatimmakki/hatim-blog-client/blob/ef9cbdb75719e3ac8a5c3b8fd4c3deccbafd1e79/Dockerfile#L23-L26
at this point in the build the variables have already been "baked" into the built website filesoh, ok thanks.. so only after the First FROM