What you see
You import your Lovable, Bolt, Cursor or v0 project from GitHub into Vercel. The build log looks healthy, Vite even prints ✓ built in 4.53s, and then the deployment fails:
Error: No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.
Learn More: https://vercel.link/missing-public-directory
Newer logs add “Alternatively, configure vercel.json#outputDirectory.” The folder in quotes can also be public or build. That’s the folder Vercel was told to serve, not necessarily the one your build created.
The confusing part: in one Vercel Community thread the same log lists dist/index.html and dist/assets/... a few lines above the error. The build did write dist. Vercel just looked somewhere else.
Why it happens
Vercel’s error list says the build step fails “if the output directory is missing, empty, or invalid”, and points at three settings: the output directory, the build command and the root directory. In practice it’s one of these:
- Wrong Framework Preset. Per Vercel’s build configuration docs, when Vercel detects your framework it sets the Output Directory for you. If nothing is detected it picks Other, which serves
publicif it exists, or the project root otherwise. A Vite app on the Other preset, or on the wrong preset, gets the wrong folder. - Wrong Root Directory. If your
package.jsonlives in a subfolder (common after an AI tool reorganizes the repo, or in a frontend/backend repo), Vercel builds in one place and looks fordistin another. The Root Directory setting exists for exactly this. - A stale
vercel.jsonoverride. The vercel.json reference saysoutputDirectoryandframeworkoverride what you set in the dashboard. A leftoverbuildsarray is worse. In this thread a Vercel team member explains that “manually specifying the builds overrides the Next preset” and leaves the project half-configured, so Vercel went looking forpublic. - The build writes a different folder. Vite’s
build.outDirdefaults todist, relative to the project root, but avite.configcan rename it. Other tools usebuildorout. And if yourbuildscript doesn’t actually runvite build(only type checks, for example), nothing is written at all.
A real example: in the Vercel Community thread “Remove Output Directory Production Override”, someone building with Cursor moved the app into a subfolder and kept getting this error, with outputDirectory pointing at the subfolder path in vercel.json. A Vercel team member got it deploying by removing the root vercel.json, setting the Root Directory to the app folder, and removing a base path from vite.config.js that didn’t even work locally. The AI assistant’s theory of a “stuck override in Vercel’s backend” was wrong; the team member said “it definitely isn’t a Vercel issue”. The thread also notes that committing node_modules/ and dist/ to the repo isn’t needed.
Fix it
1. Build locally and note the folder
From the folder that contains package.json:
npm run build
ls dist # or build / out / whatever vite.config sets as build.outDir
Write down two things: the folder name, and the path from the repo root to the folder holding package.json (for example frontend). If no folder appears, fix the build script first. No Vercel setting can serve output that doesn’t exist.
2. Set the Framework Preset
In Vercel: Project Settings > Build and Deployment > Framework Settings. For a Vite app choose Vite and leave the Output Directory override off, so Vercel uses the preset default. Only switch the override on if your build writes a non-default folder, and then type exactly that folder name (relative to the Root Directory, not the repo root).
3. Set the Root Directory
Same page, Root Directory: enter the subfolder that contains package.json, or leave it empty if package.json is at the repo root. Don’t put the subfolder path into the Output Directory as a workaround. With the right Root Directory, Output Directory is just dist.
4. Clean up vercel.json
Open vercel.json (it sits in the project root) and remove anything that fights the dashboard. If you moved the app into a subfolder, also check for a leftover vercel.json at the repo root:
{
// remove unless it is exactly the folder your build writes:
"outputDirectory": "dist",
// remove unless you mean it ("framework": null forces the Other preset):
"framework": "vite",
// remove legacy builds arrays for a normal Vite or Next.js app:
"builds": [ ... ]
}
If nothing is left but rewrites, keep only those (see step 6).
5. Redeploy
Vercel’s docs note that changes to these settings apply on the next deployment. Trigger a new one (push a commit or redeploy from the dashboard) and read the end of the log.
6. Then fix refresh 404s
Once the deploy goes live, a single-page Vite app still needs a rewrite so that reloading /dashboard doesn’t 404. Vercel’s Vite page gives this vercel.json:
{
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}
The SPA 404 on refresh guide covers it in detail, and if you’re on Netlify instead, see Deploy directory “dist” does not exist.
A prompt for your AI builder: “Vercel says No Output Directory named dist found. Show me which folder npm run build writes and where package.json is relative to the repo root. Remove outputDirectory, framework and builds from vercel.json unless they match exactly. Don’t change vite.config base or build.outDir.”
Check it worked
- The Vercel deployment log ends without the output directory error and the deployment shows Ready.
- Open the production URL: the home page loads, and the browser console has no 404s for
/assets/...files (a wrongbaseinvite.configshows up as exactly that). - Reload a deep link like
/dashboard: it should load, not 404. - If the app talks to Supabase or an API, check that your environment variables were set in Vercel before this build. Vite bakes them in at build time (env vars undefined in production).
A green deploy isn’t the same as production-ready. Run the free production-readiness checker on your new Vercel URL to catch refresh 404s, leftover localhost URLs and exposed keys in your JavaScript. If you’d rather have someone review hosting, auth, payments and Row Level Security before launch, get a written pre-launch audit.