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
- 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
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026