Deploy did not succeed: Deploy directory "site/site/public" does not exist

Site not deploying due to unclear build failure

2:51:14 PM: build-image version: 0143b4617dd9b5b3faed2aefa29c54a846e69aae (focal)
2:51:14 PM: buildbot version: 0143b4617dd9b5b3faed2aefa29c54a846e69aae
2:51:14 PM: Fetching cached dependencies
2:51:14 PM: Failed to fetch cache, continuing with build
2:51:14 PM: Starting to prepare the repo for build
2:51:14 PM: No cached dependencies found. Cloning fresh repo
2:51:14 PM: git clone --filter=blob:none https://github.com/kaovilai/velero
2:51:14 PM: Preparing Git Reference refs/heads/main
2:51:16 PM: Custom build path detected. Proceeding with the specified path: "site"
2:51:16 PM: Custom publish path detected. Proceeding with the specified path: "site/site/public"
2:51:16 PM: Custom build command detected. Proceeding with the specified command: "hugo --gc --minify"
2:51:17 PM: Starting to install dependencies
2:51:17 PM: Python version set to 3.8
2:51:17 PM: Attempting Ruby version 2.7.2, read from environment
2:51:17 PM: Using Ruby version 2.7.2
2:51:18 PM: Started restoring cached go cache
2:51:18 PM: Finished restoring cached go cache
2:51:18 PM: go version go1.19.13 linux/amd64
2:51:18 PM: Using PHP version 8.0
2:51:19 PM: Installing Hugo 0.73.0
2:51:20 PM: Hugo Static Site Generator v0.73.0-428907CC/extended linux/amd64 BuildDate: 2020-06-23T16:40:09Z
2:51:21 PM: v18.18.0 is already installed.
2:51:21 PM: Now using node v18.18.0 (npm v9.8.1)
2:51:21 PM: Enabling Node.js Corepack
2:51:21 PM: Started restoring cached build plugins
2:51:21 PM: Finished restoring cached build plugins
2:51:21 PM: Install dependencies script success
2:51:21 PM: Starting build script
2:51:22 PM: Detected 1 framework(s)
2:51:22 PM: "hugo" at version "unknown"
2:51:22 PM: Section completed: initializing
2:51:24 PM: ​
2:51:24 PM: Netlify Build                                                 
2:51:24 PM: ────────────────────────────────────────────────────────────────
2:51:24 PM: ​
2:51:24 PM: ❯ Version
2:51:24 PM:   @netlify/build 29.21.1
2:51:24 PM: ​
2:51:24 PM: ❯ Flags
2:51:24 PM:   baseRelDir: true
2:51:24 PM:   buildId: 65171ca08d9792130670f408
2:51:24 PM:   deployId: 65171ca08d9792130670f40a
2:51:24 PM: ​
2:51:24 PM: ❯ Current directory
2:51:24 PM:   /opt/build/repo/site
2:51:24 PM: ​
2:51:24 PM: ❯ Config file
2:51:24 PM:   /opt/build/repo/netlify.toml
2:51:24 PM: ​
2:51:24 PM: ❯ Context
2:51:24 PM:   production
2:51:24 PM: ​
2:51:24 PM: build.command from netlify.toml                               
2:51:24 PM: ────────────────────────────────────────────────────────────────
2:51:24 PM: ​
2:51:24 PM: $ hugo --gc --minify
2:51:24 PM: Building sites … WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:24 PM: WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:24 PM: WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:24 PM: WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:24 PM: WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:24 PM: WARN 2023/09/29 18:51:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:25 PM: WARN 2023/09/29 18:51:25 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM: WARN 2023/09/29 18:51:26 found no layout file for "HTML" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
2:51:26 PM:                    |  EN
2:51:26 PM: -------------------+-------
2:51:26 PM:   Pages            | 1971
2:51:26 PM:   Paginator pages  |    0
2:51:26 PM:   Non-page files   |  150
2:51:26 PM:   Static files     |   70
2:51:26 PM:   Processed images |    0
2:51:26 PM:   Aliases          |    0
2:51:26 PM:   Sitemaps         |    1
2:51:26 PM:   Cleaned          |    0
2:51:26 PM: Total in 2400 ms
2:51:26 PM: ​
2:51:26 PM: (build.command completed in 2.4s)
2:51:26 PM: ​
2:51:26 PM: Deploy site                                                   
2:51:26 PM: ────────────────────────────────────────────────────────────────
2:51:26 PM: ​
2:51:26 PM: Section completed: deploying
2:51:26 PM: ​
2:51:26 PM: Configuration error                                           
2:51:26 PM: ────────────────────────────────────────────────────────────────
2:51:26 PM: ​
2:51:26 PM:   Error message
2:51:26 PM:   Deploy did not succeed: Deploy directory "site/site/public" does not exist
2:51:26 PM: ​
2:51:26 PM:   Resolved config
2:51:26 PM:   build:
2:51:26 PM:     base: /opt/build/repo/site
2:51:26 PM:     command: hugo --gc --minify
2:51:26 PM:     commandOrigin: config
2:51:26 PM:     environment:
2:51:26 PM:       - HUGO_VERSION
2:51:26 PM:     publish: /opt/build/repo/site/site/public
2:51:26 PM:     publishOrigin: config
2:51:27 PM: Caching artifacts
2:51:27 PM: Started saving build plugins
2:51:27 PM: Finished saving build plugins
2:51:27 PM: Started saving pip cache
2:51:27 PM: Finished saving pip cache
2:51:27 PM: Started saving emacs cask dependencies
2:51:27 PM: Finished saving emacs cask dependencies
2:51:27 PM: Started saving maven dependencies
2:51:27 PM: Finished saving maven dependencies
2:51:27 PM: Started saving boot dependencies
2:51:27 PM: Finished saving boot dependencies
2:51:27 PM: Started saving rust rustup cache
2:51:27 PM: Finished saving rust rustup cache
2:51:27 PM: Started saving go dependencies
2:51:27 PM: Finished saving go dependencies
2:51:28 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
2:51:28 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:51:28 PM: Failing build: Failed to build site
2:51:29 PM: Finished processing build request in 14.82s

This site is a fork of https://velero.netlify.com/ so whatever settings they have there should make it work here too but I don’t know what the settings are.

In addition, I got the site working on vercel without any fuss.
Only set site/ as root dir and HUGO_VERSION env.

Upon further digging
velero/netlify.toml at main · vmware-tanzu/velero (github.com)
was causing me issues.

[build]
  base = "site/"
  command = "hugo --gc --minify"
  publish = "site/public"

This is my modified netlify.toml which worked.

[build]
  base = "site/"
  command = "hugo -v --gc --minify"
  publish = "public"

Somewhere in netlify code publish path is appended onto base path which break prior publish = "site/public" which already contained “site/”

The Web UI also enforce site/ prefix to the publish textbox.

So summary is:

  • netlify updated behavior of base and publish text field in netlify.toml
  • netlify.toml needed to be updated to accommodate (perhaps velero upstream had grandfathered in value prior to the change and was not affected)
  • netlify deploy configuration UI was working actively against resolving buggy path appending… resulting in site/site/public

Solution (without netlify’s bugfix):
Build setting

netlify.toml

[build]
  base = "site/"
  command = "hugo --gc --minify"
  publish = "public"

[context.production.environment]
  HUGO_VERSION = "0.73.0"

[context.deploy-preview.environment]
  HUGO_VERSION = "0.73.0"

Deploy before that failed commit vmain@13019b9
Deploy after that succeeded vmain@09f7744
git commit that resolve the issue vmain@09f7744

This value in netlify.toml cannot be set in netlify UI which is a bug.

Before my netlify.toml fix PR to velero is reviewed, it would be great to hear from netlify staff to confirm whether or not publish field automatically prefixed with base directory automatically in the backend AND the web UI also doing it causing the base directory to appear twice in the publish path as site/site/public causing directory did not exist is a valid netlify bug that needs addressing from netlify and that the PR is not worsening the problem after netlify is fixed…

When you set the base path, everything becomes relative to that. So if base path is /site and you set the publish path as /site/public, your publish path would now be /site/site/public.

Then your web UI is broken as it’s enforcing basepath be applied to publish path and so net net it’s doing it twice if you don’t have a dedicated toml file.

Okay, thank you for the feedback. We’ll let the devs know.

@hrishikesh it looks like velero has baseRelDir: false [2] while mine has baseRelDir: true [1] which is causing incompatibilities between the two sites netlify config.

How to I change this value?
[1] Netlify App
[2] Netlify App

Revert PR #6907 as site is not deploying by OrlinVasilev · Pull Request #6981 · vmware-tanzu/velero (github.com)