Output directory not found 🟧 Cloudflare

Cloudflare Pages build: Error: Output directory "dist" not found / Failed: build output directory not found

The Pages build finished, but the folder set as “Build output directory” doesn’t exist — the framework wrote its files somewhere else, or the build command didn’t run.

Seen on: Cloudflare

Meaning

Each framework outputs to a different folder (Vite dist, Next.js static export out, Astro dist, Hugo public, CRA build). A wrong root directory (monorepo), a missing build command, or a build that silently skipped output all cause this.

Common causes

  • Output directory setting doesn’t match the framework
  • Build command empty or wrong (nothing built)
  • Monorepo: root directory not set to the app folder
  • Next.js without static export (output: 'export')

⚡ Quick fix

  1. Set the correct output directory for your framework
  2. Set root directory for monorepos
  3. Run the build locally and see which folder appears

Detailed fix by platform

Shell

  1. npm run build && ls -d dist build out public 2>/dev/null

JavaScript

  1. javascript
    // next.config.js for static Pages deployments
    module.exports = { output: 'export' };   // writes to out/

How to diagnose

  1. Settings — Build command, output dir, root dir
  2. Local — Folder produced by npm run build

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.