2 months ago
So I'm using a Nx as monorepo and pnpm workspace, the problem is:
I setup a railway.toml, but the railpack it's just ignoring the build cmd:
[build]
builder = "railpack"
buildCommand = "pnpm --filter api exec prisma generate && pnpm nx build api"
watchPatterns = ["apps/api/**", "packages/**", "package.json", "pnpm-lock.yaml"]
[deploy]
startCommand = "node dist/apps/api/main.js"
restartPolicyType = "on_failure"And it's just trying to run:
pnpm nx build backend 3s NX Cannot find project 'backend'
ERROR: failed to build: failed to solve: process "sh -c pnpm nx build backend" did not complete successfully: exit code: 1I can try to change the app to be backend, but I like to use api.
2 Replies
2 months ago
Railway auto detect an NX project. and run its default build command , try build command move to deploy,
[build]
builder = "railpack"
[deploy]
buildCommand = "pnpm --filter api exec prisma generate && pnpm nx build api"
startCommand = "node dist/apps/api/main.js"
restartPolicyType = "on_failure"
if not work use nixpacks builder
2 months ago
Railpack sees your nx.json and thinks "I know how to build NX projects" — so it ignores your railway.toml and runs its own command: pnpm nx build <defaultProject>.
Your nx.json probably has this:
{
"defaultProject": "backend"
}
That's where backend comes from. Change it to api and Railpack will run pnpm nx build api.