Skip to content
Latchkey

Netlify "Deploy directory does not exist" in CI

The Netlify CLI was told to publish a directory that is not present on the runner. The build either did not run, failed, or wrote its output to a different path than the one passed with --dir.

What this error means

A netlify deploy --dir=... step fails with "Error: Deploy did not succeed: Deploy directory \"dist\" does not exist".

Netlify CLI
Error: Deploy did not succeed: Deploy directory "dist" does not exist

Common causes

The build did not run or failed

The publish directory is created by the build; if the build step was skipped or errored, the directory is missing.

The --dir value does not match the build output

The framework writes to build or out, but the deploy passes --dir=dist, so the named directory is empty or absent.

How to fix it

Build first and point --dir at the real output

  1. Run the build step so the publish directory exists.
  2. Set --dir to the directory the framework actually writes.
  3. Confirm with ls before deploying.
.github/workflows/ci.yml
- run: npm run build
- run: netlify deploy --prod --dir=dist

Set the publish directory in netlify.toml

Define publish in netlify.toml so the CLI and dashboard agree on the output path.

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

How to prevent it

  • Run the build before the deploy step.
  • Keep --dir in sync with the framework output directory.
  • Define publish in netlify.toml as the single source of truth.

Frequently asked questions

What causes "Netlify "Deploy directory does not exist""?
The publish directory is created by the build; if the build step was skipped or errored, the directory is missing.
How do I fix Netlify "Deploy directory does not exist"?
Build first and point --dir at the real output

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card