Skip to content
Latchkey

Next.js ENOENT .next/build-manifest - Fix in CI

Next looked for .next/build-manifest.json and it is not there. A start/export step ran before next build, or a cache step restored a partial .next.

What this error means

A next start, export, or post-build step fails with ENOENT: no such file or directory, open '.next/build-manifest.json'.

next
Error: ENOENT: no such file or directory, open
'/app/.next/build-manifest.json'
    at Object.openSync (node:fs:600:3)

Common causes

Build step skipped or failed silently

next start/export ran without a successful next build first, so .next is missing or incomplete.

Partial .next cache restored

A CI cache restored a stale or incomplete .next directory missing the manifest.

How to fix it

Build before start/export

  1. Ensure next build runs and succeeds before any step that reads .next.
Terminal
npm run build && npm run start

Stop caching the full .next output

  1. Cache only the Next build cache, not the whole .next, or clean before building.
Terminal
# cache key for .next/cache only; rebuild .next fresh each run
rm -rf .next && npm run build

How to prevent it

  • Fail the pipeline if next build does not exit zero before downstream steps.
  • Cache .next/cache only, never the full .next artifact.

Related guides

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