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.
Deploy directory "dist" does not exist
Failed during stage 'deploying site': Deploy directory does not existCommon 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.
[build]
base = "frontend/"
command = "npm run build"
publish = "frontend/dist"Verify the build output path
- Run the build locally and note the exact output folder.
- Remember
publishis relative to the repo root, butbasechanges the working directory for the build. - Match
publishto<base>/<build-output>and redeploy.
How to prevent it
- Keep
publishaligned with the build tool’s output directory. - Be deliberate about how
baseoffsetscommandandpublish. - Version these in
netlify.tomlrather than only in the UI.