a year ago
I have problems with building project, and I just need quick help, so in my railway.json I have this line of code:
"buildCommand": "cd client && npm i -y && npm run build"
however, while project is building, it crashes with log that npm command is not found, now my project is spilt into 2 parts: /client and /server. that is reason why I used cd client && npm i -y && npm run build since I guess these commands are executed on root level, so logically it will first enter client dir, and inside there call npm commands, but its not.
ⓘ Deployment information is only viewable by Project members and Railway admins.
10 Replies
a year ago
Are you able to share your repo?
sure, here is the URL: https://github.com/Vjecni/GodsEye
a year ago
This project has quite an unoptimized project structure, let me see if I can fix it.
I'll see about making a PR, and then I will follow up with deployment instructions.
a year ago
This project has quite an unoptimized project structure, let me see if I can fix it.
I'll see about making a PR, and then I will follow up with deployment instructions.
sure, thank you very much
a year ago
also, note: if I set that my project root is inside client, and then if I set buildCommand to be only npm run build
it would work..
a year ago
You were trying to run your frontend and backend in one service, if not done properly this can cause a lot of issues, you unfortunately were not doing it properly, so I took the easier route and configured your service as an isolated mono repo.
Here is the PR with those changes - https://github.com/Vjecni/GodsEye/pull/1
To deploy this isolated mono-repo you will need a Railway project with two Railway services in the same project -
A service named Client
and a service named Server
Both of these services will deploy from the same repo.
The Server
service will have its root directory set to /server
The Client
service will have its root directory set to /client
The root directory setting is found via the service's settings page.
On the Client
service, you will need a VITE_BACKEND_URL
service variable set to https://${{Server.RAILWAYPUBLICDOMAIN}}
Ask if you need clarification on anything that I didn't already cover.
a year ago
alright, I fixed the repo errors that you pointed out, now I created 2 services, I think I configured them out good, Now I just need to figure out to server the apps, since Client service doesn't show frontend and server service just outputs "Not found"
a year ago
also, Client service, inside deploy logs only spams this message:Error: adapting config using caddyfile: Caddyfile:2: unrecognized directive: admin using provided configuration
a year ago
I followed the procedure above and deployed both server and client without issue.
Sorry but I won't be able to provide further help unless you merge my working PR.