Skip to content
Latchkey

Next.js "ENOENT: no such file or directory, open '.next/...'" in CI

A step (next start, a test, or a deploy) tried to read a file inside .next that does not exist. Either next build never ran in that job, the .next directory was not restored from a cache or artifact, or a prior build failed before writing it.

What this error means

A job fails with "Error: ENOENT: no such file or directory, open '/home/runner/work/app/app/.next/build-manifest.json'" or "Could not find a production build in the '.next' directory".

next start
Error: ENOENT: no such file or directory, open
'/home/runner/work/app/app/.next/build-manifest.json'

> Could not find a production build in the '.next' directory.
Try building your app with 'next build' before starting the production server.

Common causes

next start runs without a completed next build

The job starts the production server in a separate step or job where .next was never produced.

The .next directory was not passed between jobs

Split build and run jobs need .next uploaded as an artifact or cached; otherwise the run job has no build output.

How to fix it

Build before starting in the same job

  1. Ensure next build runs and succeeds before next start or any step reading .next.
  2. Keep both steps in the same job, or pass .next between jobs.
  3. Re-run the workflow.
.github/workflows/ci.yml
- run: npm run build   # produces .next
- run: npm run start   # reads .next

Persist .next across jobs as an artifact

If build and run are separate jobs, upload and download the build output.

.github/workflows/ci.yml
- uses: actions/upload-artifact@v4
  with: { name: next-build, path: .next }

How to prevent it

  • Run next build before any step that reads .next.
  • Pass build output between split jobs via artifacts or cache.
  • Fail fast if the build step errored before consuming its output.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →