Builder keeps switching from Nixpacks to Railpack mid-build
1disrupter
PROOP

25 days ago

Even with .nixpacks.toml, correct root directory, and no Dockerfile, the builder starts with Nixpacks but switches back to Railpack mid-build.

Logs show:

Code

UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH'

This appears to come from a corrupted internal Nixpacks plan or snapshot. I need the project’s build cache and snapshot fully reset on your side.

Please clear all Railpack metadata and cached build plans for this project.

Solved$20 Bounty

4 Replies

Status changed to Open Railway 25 days ago


domehane
FREE

25 days ago

Hello 1disrupter,

nixpacks is deprecated on railway now and railpack is the new default which explains the switching. the $NIXPACKS_PATH error is caused by a corrupted cached build plan, add NIXPACKS_NO_CACHE=1 as an env variable to force a clean build

Hope this help you :)


I recommend you switch to Railpack, as Nixpacks is deprecated.


1disrupter
PROOP

25 days ago

Update: After digging deeper, it turns out the issue wasn’t my code or config — it was Railpack’s build caching inside the project. Even after deleting and recreating the frontend service, Railpack kept restoring an old cached build layer at the project level, which meant:

  • no fresh build ever ran
  • no npm install
  • no npm run build
  • the frontend folder was never used
  • the UI stayed stuck on an old container image

The logs always showed:

Code

copy /root/.cache cached
copy /app, /app/node_modules

…which means Railpack skipped the build entirely because it thought the commit had already been built before the railpack.json existed.

Even with the correct railpack.json and the correct root directory set, Railpack never re‑scanned the repo — it just reused the cached container.

Solution: The only reliable fix is to create a brand‑new Railway project, deploy the repo again, and set the root directory to frontendbefore the first build. A new project forces Railpack to rebuild from scratch with no cached layers, and it finally picks up the correct workdir and builds the actual frontend.

Posting this so others don’t waste hours fighting a poisoned Railpack cache inside an existing project.


25 days ago

You can try using the NO_CACHE=1 env var next time, I will be marking this as solved.


Status changed to Solved medim 25 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...