Vercel "No Output Directory named dist found after the Build completed": the build worked, the deploy failed

By AI App Medic · Updated · Vercel · Vite · Deploy · Cursor

You import a project from GitHub into Vercel. The log looks healthy. Vite even prints that it built the site. Then the deployment fails with this:

vite v5.4.2 building for production...
1832 modules transformed.
dist/index.html                   0.46 kB
dist/assets/index-DiwrgTda.css   14.21 kB
dist/assets/index-BcYzXv3a.js   312.80 kB
built in 4.53s
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 may add a line about configuring vercel.json#outputDirectory. The folder in quotes is not always dist. You may see public or build. The important part is that it is the folder Vercel was told to serve, which may not be the folder your build wrote. If you see the files listed a few lines above the error, you already know the build is fine and the problem is a setting.

This hits Lovable, Bolt and Cursor exports a lot because a Git import is the first time the project meets Vercel's configuration. Vercel's error documentation describes it plainly: the build step fails when the output directory is missing, empty or invalid, and it points at three things to check: the Output Directory setting, the build command and the Root Directory. Here is how to tell which one it is.

Step 1: build locally and note two things

From the folder that contains package.json, run the same build Vercel runs:

npm ci
npm run build
ls dist

Write down the folder name (dist, build, out) and the path from the repository root to the folder with package.json. If no folder appears, the problem is your build script, and no Vercel setting can serve files that do not exist. Open package.json and make sure "build" runs vite build, and not only a type check:

"scripts": {
  "dev": "vite",
  "build": "vite build",
  "preview": "vite preview"
}

Cause 1: the wrong Framework Preset

Per Vercel's build configuration documentation, when Vercel detects your framework it sets the Output Directory for you. If it detects nothing, the preset is Other, which serves public if that folder exists and the project root otherwise. A Vite app on the Other preset, or on the wrong preset, gets the wrong folder.

Fix: open the project in Vercel, go to Settings, Build and Deployment, Framework Settings. Choose Vite as the Framework Preset. Leave the Output Directory override switched off, so the preset's default is used. Save and redeploy.

Cause 2: the app is in a subfolder

If your repository has the app in frontend, app or apps/web, Vercel builds at the repo root and looks for the output somewhere else. AI tools sometimes reorganize a repository into folders without telling you. Set the Root Directory to the folder that holds package.json. In Settings, Build and Deployment, scroll to Root Directory, enter the path, such as frontend, and save. The setting takes effect on the next deployment. An Output Directory you set is relative to the Root Directory, not to the repository root.

Cause 3: a stale vercel.json

Vercel's vercel.json reference says that outputDirectory overrides the Output Directory in Project Settings for that deployment. A file left over from an earlier setup can point to the wrong place and beat whatever you set in the dashboard. A legacy builds array is even worse, since it replaces automatic framework handling. Open vercel.json in the root of the project and either delete the file or reduce it to what is true:

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "framework": "vite",
  "buildCommand": "npm run build",
  "outputDirectory": "dist"
}

Only keep outputDirectory if it matches the folder you saw the build create. If you keep a vercel.json in a repository that has both a root and an app folder, make sure the one Vercel reads is in the Root Directory you set.

Cause 4: the build writes a different folder

Vite's build.outDir defaults to dist, but a config file can change it. Check vite.config.ts:

export default defineConfig({
  plugins: [react()],
  build: {
    outDir: "build",   // renamed, so Vercel must be told, or this line removed
  },
});

Either remove the outDir line so the default dist applies, or turn on the Output Directory override in Vercel and type build. A base option that was added to make a different host work can also confuse things, so remove options you cannot explain.

Cause 5: the project is not a Vite app at all

A project from v0 is a Next.js app. Next.js does not output dist. If someone set the Output Directory to dist or public on a Next.js project, or the preset says Other, Vercel fails with this same message. Set the Framework Preset to Next.js and leave the Output Directory empty. The same check applies to Astro (dist), Create React App (build) and others, so choose the preset that matches what the project really is.

Step: redeploy cleanly

After changing settings, go to Deployments, open the three dot menu on the latest deployment, choose Redeploy and turn off "Use existing Build Cache" so nothing stale carries over. When the deployment passes, open the live URL and check the homepage loads with its CSS.

After it deploys: fix the refresh 404 separately

A single page app on Vercel needs a rewrite to index.html, or a page reload on /dashboard returns a 404. That is a different problem, and it only appears once the site is live. Do not add a rewrite to try to make this error go away, since there is no index.html to rewrite to until the output folder is found. When you get there, the React SPA 404 on refresh guide has the exact configuration, and you can combine it with the file above:

{
  "framework": "vite",
  "outputDirectory": "dist",
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}

If the build itself fails

If the log shows an error before the output check, such as a TypeScript error, a missing module or an install failure, that is a different problem. The Cursor app Vercel build failed guide covers those. If the deploy passes but the page is blank, see Lovable blank page after deploy, which is usually missing environment variables.

Prevention

Before you import a project, run npm run build on a clean clone and confirm the folder appears. Keep one place for configuration, either dashboard settings or vercel.json, and do not let both disagree. Commit your lockfile. If an AI tool asks to move files into subfolders, check the Root Directory right after. And never commit dist or node_modules to make a deploy pass.

FAQ

Why does the log show a successful build and then this error?

The build step and the output check are separate. Vite wrote its files, but Vercel looked in a different folder because of the Framework Preset, the Root Directory or an override. The error names the folder Vercel was told to serve, not the one your build created.

Why does the error mention public or build instead of dist?

Vercel names whatever folder it expected. With the Other preset it serves public if that exists, so you may see public. Create React App writes build, and a custom setting can name any folder. Match the setting to what your build really writes.

Should I commit the dist folder to fix it?

No. Vercel runs the build itself. Committing dist and node_modules is not needed and hides the real problem, which is a setting that points at the wrong place.

Is this the same as a 404 NOT_FOUND on my deployed site?

No. This error fails the deployment, so nothing goes live. A 404 NOT_FOUND on a page that is live is a routing problem, usually a missing rewrite to index.html for a single page app.

What should the Output Directory be for a Next.js app?

Leave it empty. Vercel detects Next.js and handles the output itself. Setting dist or public on a Next.js project is a common cause of this exact error, for example after a v0 project is moved to a new repository.

Related guides