Persistent Build Failure: /api/package.json: not found in Monorepo Docker Build
cannamuffinman
PROOP

a month ago

We are experiencing a persistent build failure on Railway for our API service in a Node.js monorepo. The error is now:

Build Failed: build daemon returned an error < failed to solve: failed to compute cache key: failed to calculate checksum of ref ...: "/.nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix": not found >

What We’ve Tried:

Confirmed api/package.json exists, is tracked in git, and is not a symlink or LFS pointer.

-Verified all file names and presence via git and filesystem.

-.dockerignore, .gitattributes, and .gitignore do not exclude or transform api/package.json.

-Set build context to repo root, tried both root and subfolder Dockerfiles.

-All Dockerfiles have now been fully removed from the repo.

-Switched to Nixpacks (no Dockerfile present), and set the service root to api.

-Used “Clear cache and redeploy” multiple times.

-Pushed both monorepo-root and API-only changes to trigger fresh builds.

-No other CI/CD or local Docker builds have this issue.

Current Error:

After removing all Dockerfiles, Railway now attempts a Nixpacks build but fails with:

Build Failed: build daemon returned an error < failed to solve: failed to compute cache key: failed to calculate checksum of ref ...: "/.nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix": not found >

What We Think Is Wrong:

-All repo-side, ignore, and config issues have been exhaustively ruled out.

-The error appears to be a Railway platform bug, build context resolution issue, or a caching problem on Railway’s infrastructure.

What We Need from Railway:

Investigate why the Nixpacks build is failing with a missing .nixpacks file, despite a clean repo and no Dockerfiles.

Confirm that the build context and Nixpacks detection are working as expected.

Advise if there are any known issues with Nixpacks builds, cache, or monorepo setups.

Provide any platform-side logs or diagnostics that could help us understand why the file is missing.

Suggest any additional steps or configuration changes that could resolve this.

Repo Structure (relevant parts):

/package.json

/package-lock.json

/api/package.json

/api/...

/.dockerignore

/railway.toml

Summary:

We have exhausted all repo-side and config workarounds. The persistent error appears to be a Railway platform/build system issue. Please help us resolve this so we can deploy our API.

Solved

1 Replies

Railway
BOT

a month ago

Your build error path (/.nixpacks/) confirms the service is using the legacy Nixpacks builder, which is no longer the default. Our current default builder is Railpack. In your railway.toml, either remove the builder line entirely to use the default Railpack builder, or explicitly set builder = "railpack" under the [build] section. Also note that the Railway config file path does not follow the root directory setting, so if your railway.toml is at the repo root but your service's root directory is set to api, you need to ensure the config file path in your service settings points to the absolute path (e.g., /railway.toml). Finally, to fully disable build caching, add the environment variable NO_CACHE=1 to your service, as the "Clear cache and redeploy" button in the dashboard does not always clear all build layers.


Status changed to Awaiting User Response Railway about 1 month ago


Status changed to Solved cannamuffinman about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...