[Error in deployment] public folder is not created for hugo

I am trying to host hugo in Netlify and given the build command hugo and publish in the directory public. Unfortunately, the public directory is not generated with the build command hugo and throwing below error " Deploy did not succeed: Deploy directory 'public' does not exist " while deploying

I tried creating netlify.toml file as well and Netlify took the command from my .toml file but throwing the same error

Netlify site name.: inspiring-hodgkin-783ed9

FULL build log:
6:14:35 PM: Build ready to start
6:14:37 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
6:14:37 PM: build-image tag: v3.7.1
6:14:37 PM: buildbot version: f8ec74861753a79c1e9b582ecf018c0cd8e5c53d
6:14:37 PM: Fetching cached dependencies
6:14:37 PM: Failed to fetch cache, continuing with build
6:14:37 PM: Starting to prepare the repo for build
6:14:38 PM: No cached dependencies found. Cloning fresh repo
6:14:38 PM: git clone https://github.com/ashiya12/test_blog
6:14:39 PM: Preparing Git Reference refs/heads/main
6:14:43 PM: Starting build script
6:14:43 PM: Installing dependencies
6:14:43 PM: Python version set to 2.7
6:14:44 PM: v12.18.0 is already installed.
6:14:45 PM: Now using node v12.18.0 (npm v6.14.4)
6:14:45 PM: Started restoring cached build plugins
6:14:45 PM: Finished restoring cached build plugins
6:14:45 PM: Attempting ruby version 2.7.1, read from environment
6:14:47 PM: Using ruby version 2.7.1
6:14:47 PM: Using PHP version 5.6
6:14:47 PM: Installing Hugo 0.82.0
6:14:48 PM: hugo v0.82.0-9D960784+extended linux/amd64 BuildDate=2021-03-21T17:28:04Z VendorInfo=gohugoio
6:14:48 PM: Started restoring cached go cache
6:14:48 PM: Finished restoring cached go cache
6:14:48 PM: go version go1.14.4 linux/amd64
6:14:48 PM: go version go1.14.4 linux/amd64
6:14:48 PM: Installing missing commands
6:14:48 PM: Verify run directory
6:14:50 PM: ​
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: Netlify Build
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: ​
6:14:50 PM: ❯ Version
6:14:50 PM: @netlify/build 10.2.7
6:14:50 PM: ​
6:14:50 PM: ❯ Flags
6:14:50 PM: deployId: 607471eb4fa5bd542a299b84
6:14:50 PM: ​
6:14:50 PM: ❯ Current directory
6:14:50 PM: /opt/build/repo
6:14:50 PM: ​
6:14:50 PM: ❯ Config file
6:14:50 PM: /opt/build/repo/netlify.toml
6:14:50 PM: ​
6:14:50 PM: ❯ Context
6:14:50 PM: production
6:14:50 PM: ​
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: 1. build.command from netlify.toml
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: ​
6:14:50 PM: $ hugo --gc --minify
6:14:50 PM: Start building sites …
6:14:50 PM: | EN
6:14:50 PM: -------------------±----
6:14:50 PM: Pages | 17
6:14:50 PM: Paginator pages | 0
6:14:50 PM: Non-page files | 0
6:14:50 PM: Static files | 6
6:14:50 PM: Processed images | 0
6:14:50 PM: Aliases | 6
6:14:50 PM: Sitemaps | 1
6:14:50 PM: Cleaned | 0
6:14:50 PM: Total in 57 ms
6:14:50 PM: ​
6:14:50 PM: (build.command completed in 130ms)
6:14:50 PM: ​
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: 2. Deploy site
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: ​
6:14:50 PM: ​
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: Configuration error
6:14:50 PM: ────────────────────────────────────────────────────────────────
6:14:50 PM: ​
6:14:50 PM: Error message
6:14:50 PM: Deploy did not succeed: Deploy directory ‘public’ does not exist
6:14:50 PM: ​
6:14:50 PM: Resolved config
6:14:50 PM: build:
6:14:50 PM: command: hugo --gc --minify
6:14:50 PM: commandOrigin: config
6:14:50 PM: environment:
6:14:50 PM: - HUGO_VERSION
6:14:50 PM: - HUGO_ENV
6:14:50 PM: - HUGO_ENABLEGITINFO
6:14:50 PM: publish: /opt/build/repo/public
6:14:50 PM: Caching artifacts
6:14:50 PM: Started saving build plugins
6:14:50 PM: Finished saving build plugins
6:14:50 PM: Started saving pip cache
6:14:50 PM: Finished saving pip cache
6:14:50 PM: Started saving emacs cask dependencies
6:14:50 PM: Finished saving emacs cask dependencies
6:14:50 PM: Started saving maven dependencies
6:14:50 PM: Finished saving maven dependencies
6:14:50 PM: Started saving boot dependencies
6:14:50 PM: Finished saving boot dependencies
6:14:50 PM: Started saving rust rustup cache
6:14:50 PM: Finished saving rust rustup cache
6:14:50 PM: Started saving go dependencies
6:14:50 PM: Finished saving go dependencies
6:14:53 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:14:53 PM: Creating deploy upload records
6:14:53 PM: Failing build: Failed to build site
6:14:53 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
6:14:53 PM: Finished processing build request in 16.597517479s

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

Hi Perry,

Our problem is not cited in the support guide. The error is provided in the screenshot already uploaded:

6:14:50 PM: Error message 6:14:50 PM: Deploy did not succeed: Deploy directory ‘public’ does not exist

and we do not use npm.

hi @nethsa :wave: , as mentioned in these docs, which are linked in the guide, you can absolutely change your output directory to be something other than public if you would like.

Or, you can opt to create a directory called public and point us to load your index.html from that location - your choice!