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.
Output directory not foundFailed: build output directory not foundError: Output directory "dist" not foundFailed: build output directory 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
- Set the correct output directory for your framework
- Set root directory for monorepos
- Run the build locally and see which folder appears
Detailed fix by platform
Shell
npm run build && ls -d dist build out public 2>/dev/null
JavaScript
- javascript
// next.config.js for static Pages deployments module.exports = { output: 'export' }; // writes to out/
How to diagnose
- Settings — Build command, output dir, root dir
- 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:
Similar errors
Most viewed in Cloudflare
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026