a year ago
Django backed seems like it's connecting fine, but can't get anything from React front end, is there a different build command other than "npm run build" that I need to add? or maybe a dumb question, but first time just trying to learn to deploy, am I even able to host front end here in the same environment? or does that need to handled separately?
build log:
8 [4/5] RUN npm run build
8 0.304 /bin/bash: line 1: npm: command not found
#8 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 127
[4/5] RUN npm run build:
0.304 /bin/bash: line 1: npm: command not found
Dockerfile:15
13 | # build phase
14 | COPY . /app/.
15 | >>> RUN npm run build
16 |
17 |
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 127
Error: Docker build failed
ⓘ Deployment information is only viewable by Project members and Railway admins.
9 Replies
a year ago
sure thing, I tried adding start script into package.json and changing root to my /frontend, which deployed, but still coudn't connect and kept getting a "sh: 1: react-scripts: not found" error, so I removed those changes and am back here now
Attachments
a year ago
also the current build log:
[Region: us-west1]
Using Nixpacks
context: 97837741f6569574dfdf0b31f6eb7a28
Nixpacks build failed
╔════════ Nixpacks v1.21.2 ═══════╗
║ setup │ nodejs18, npm-9x ║
║─────────────────────────────────║
║ install │ npm ci ║
║─────────────────────────────────║
║ build │ npm run build ║
║─────────────────────────────────║
║ start │ ║
╚═════════════════════════════════╝
Error: No start command could be found
a year ago
You have a backend and frontend app in the same repo, that's known as a monorepo, this means you need two Railway services.
Both services will deploy from the same GitHub repo, but one service will have its root directory set to /frontend
and the other service will have its root directory set to /backend
Make sure to set the applicable service variables for each service.
For your backend to work correctly you need to be using gunicorn in your Procfile, and Postgres as the database.
For your frontend to work, you will need to copy the nixpacks.toml and Caddyfile from this example repo into your frontend folder -
a year ago
knew pulling everything at once seemed too easy lol. That makes way more sense now, thanks a ton for the help!
a year ago
heyo! getting back to fixing this, in Procfile I'm using "web: gunicorn backend.wsgi" and I'm getting this error: "usage: gunicorn [OPTIONS] [APPMODULE] gunicorn: error: unrecognized arguments: --logfile--" do you know what the options/appmodule argument should be?