Skip to content
Latchkey

Netlify "Deploy directory does not exist" - Fix Publish Dir in CI

The build finished but Netlify could not find the publish directory it was told to deploy. The configured publish path does not match where the build actually wrote files - often a base-directory mismatch.

What this error means

After a successful build, the deploy fails with Deploy directory "<dir>" does not exist. It is deterministic: the publish path is wrong relative to the base directory every run.

Netlify deploy log
Deploy directory "dist" does not exist
Failed during stage 'deploying site': Deploy directory does not exist

Common causes

Publish path does not match build output

The publish setting points at a folder the build does not create (e.g. dist when the build emits build), so there is nothing to deploy.

Base directory offsets the publish path

When base is set (e.g. frontend/), publish is resolved relative to it. A publish = "dist" with base = "frontend" looks for frontend/dist - a frequent source of mismatch.

How to fix it

Align publish with the actual output

Set publish to the directory the build produces, accounting for base.

netlify.toml
[build]
  base = "frontend/"
  command = "npm run build"
  publish = "frontend/dist"

Verify the build output path

  1. Run the build locally and note the exact output folder.
  2. Remember publish is relative to the repo root, but base changes the working directory for the build.
  3. Match publish to <base>/<build-output> and redeploy.

How to prevent it

  • Keep publish aligned with the build tool’s output directory.
  • Be deliberate about how base offsets command and publish.
  • Version these in netlify.toml rather than only in the UI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →