Deployment Error for Hugo Site - Cannot find Theme Directory

Hello there

To summarise - I have built a Hugo static site that works great on my local machine, however when I try and deploy it from Netlify I get an error: Unable to find theme directory /opt/build/repo/themes/hugo-kiera

Build is https://app.netlify.com/sites/mystifying-payne-7f1af9

Here is the full error log:
2:51:09 PM: Build ready to start
2:51:11 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
2:51:11 PM: build-image tag: v3.6.0
2:51:11 PM: buildbot version: 8ae026ef4905d9174e416775c6b64aa19950569b
2:51:11 PM: Fetching cached dependencies
2:51:11 PM: Failed to fetch cache, continuing with build
2:51:11 PM: Starting to prepare the repo for build
2:51:11 PM: No cached dependencies found. Cloning fresh repo
2:51:11 PM: git clone https://github.com/TeldridgeLDN/servicexdesign_backup
2:51:13 PM: Preparing Git Reference refs/heads/main
2:51:14 PM: Starting build script
2:51:14 PM: Installing dependencies
2:51:14 PM: Python version set to 2.7
2:51:15 PM: v12.18.0 is already installed.
2:51:16 PM: Now using node v12.18.0 (npm v6.14.4)
2:51:16 PM: Started restoring cached build plugins
2:51:16 PM: Finished restoring cached build plugins
2:51:16 PM: Attempting ruby version 2.7.1, read from environment
2:51:17 PM: Using ruby version 2.7.1
2:51:18 PM: Using PHP version 5.6
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.14.4 linux/amd64
2:51:18 PM: go version go1.14.4 linux/amd64
2:51:18 PM: Installing missing commands
2:51:18 PM: Verify run directory
2:51:19 PM: ​
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: Netlify Build
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: ​
2:51:19 PM: ❯ Version
2:51:19 PM: @netlify/build 8.0.0
2:51:19 PM: ​
2:51:19 PM: ❯ Flags
2:51:19 PM: deployId: 5fef36dd6610cc21ea55caf9
2:51:19 PM: mode: buildbot
2:51:19 PM: ​
2:51:19 PM: ❯ Current directory
2:51:19 PM: /opt/build/repo
2:51:19 PM: ​
2:51:19 PM: ❯ Config file
2:51:19 PM: No config file was defined: using default values.
2:51:19 PM: ​
2:51:19 PM: ❯ Context
2:51:19 PM: production
2:51:19 PM: ​
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: 1. Build command from Netlify app
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: ​
2:51:19 PM: $ hugo
2:51:19 PM: Error: Unable to find theme Directory: /opt/build/repo/themes/hugo-kiera
2:51:19 PM: ​
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: β€œbuild.command” failed
2:51:19 PM: ────────────────────────────────────────────────────────────────
2:51:19 PM: ​
2:51:19 PM: Error message
2:51:19 PM: Command failed with exit code 255: hugo
2:51:19 PM: ​
2:51:19 PM: Error location
2:51:19 PM: In Build command from Netlify app:
2:51:19 PM: hugo
2:51:19 PM: ​
2:51:19 PM: Resolved config
2:51:19 PM: build:
2:51:19 PM: command: hugo
2:51:19 PM: commandOrigin: ui
2:51:19 PM: publish: /opt/build/repo/public
2:51:20 PM: Caching artifacts
2:51:20 PM: Started saving build plugins
2:51:20 PM: Finished saving build plugins
2:51:20 PM: Started saving pip cache
2:51:20 PM: Finished saving pip cache
2:51:20 PM: Started saving emacs cask dependencies
2:51:20 PM: Finished saving emacs cask dependencies
2:51:20 PM: Started saving maven dependencies
2:51:20 PM: Finished saving maven dependencies
2:51:20 PM: Started saving boot dependencies
2:51:20 PM: Finished saving boot dependencies
2:51:20 PM: Started saving rust rustup cache
2:51:20 PM: Finished saving rust rustup cache
2:51:20 PM: Started saving rust cargo bin cache
2:51:20 PM: Finished saving rust cargo bin cache
2:51:20 PM: Started saving go dependencies
2:51:20 PM: Finished saving go dependencies
2:51:22 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:51:22 PM: Failing build: Failed to build site
2:51:22 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
2:51:22 PM: Finished processing build request in 11.423861329s

I have looked at the board for similar issues / possible solutions to mine. The nearest I could find was this one which I have followed to create a submodule git of the theme hugo-kiera.

Hope someone can steer this newbie to getting this deployed successfully

From what I see, you indeed don’t have a theme folder in your repo:

Thank you @hrishikesh for highlighting the issue. I genuinely thought I had Themes>hugo-kiera folders set up in my repo.

I have now corrected this by updating the files on my local machine and starting a fresh repo on GitHub with the folder structure in place.

When I deployed again I ran into an issue where I got the following message:

HUGO-KIERA theme does not support Hugo version 0.54.0. Minimum version required is 0.55.0

Does that mean I need to have Hugo version 0.55.0 installed on Netlify?

The full log is below
5:35:59 PM: Build ready to start
5:36:01 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
5:36:01 PM: build-image tag: v3.6.0
5:36:01 PM: buildbot version: 8ae026ef4905d9174e416775c6b64aa19950569b
5:36:01 PM: Fetching cached dependencies
5:36:01 PM: Failed to fetch cache, continuing with build
5:36:01 PM: Starting to prepare the repo for build
5:36:01 PM: No cached dependencies found. Cloning fresh repo
5:36:01 PM: git clone https://github.com/TeldridgeLDN/servicexdesignv2
5:36:03 PM: Preparing Git Reference refs/heads/main
5:36:05 PM: Starting build script
5:36:05 PM: Installing dependencies
5:36:05 PM: Python version set to 2.7
5:36:06 PM: v12.18.0 is already installed.
5:36:07 PM: Now using node v12.18.0 (npm v6.14.4)
5:36:07 PM: Started restoring cached build plugins
5:36:07 PM: Finished restoring cached build plugins
5:36:07 PM: Attempting ruby version 2.7.1, read from environment
5:36:08 PM: Using ruby version 2.7.1
5:36:08 PM: Using PHP version 5.6
5:36:08 PM: Started restoring cached go cache
5:36:08 PM: Finished restoring cached go cache
5:36:08 PM: go version go1.14.4 linux/amd64
5:36:08 PM: go version go1.14.4 linux/amd64
5:36:08 PM: Installing missing commands
5:36:08 PM: Verify run directory
5:36:10 PM: ​
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: Netlify Build
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: ​
5:36:10 PM: ❯ Version
5:36:10 PM: @netlify/build 8.0.0
5:36:10 PM: ​
5:36:10 PM: ❯ Flags
5:36:10 PM: deployId: 5fef5d7fff43c6744786bb9a
5:36:10 PM: mode: buildbot
5:36:10 PM: ​
5:36:10 PM: ❯ Current directory
5:36:10 PM: /opt/build/repo
5:36:10 PM: ​
5:36:10 PM: ❯ Config file
5:36:10 PM: No config file was defined: using default values.
5:36:10 PM: ​
5:36:10 PM: ❯ Context
5:36:10 PM: production
5:36:10 PM: ​
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: 1. Build command from Netlify app
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: ​
5:36:10 PM: $ hugo
5:36:10 PM: ERROR 2021/01/01 17:36:10 HUGO-KIERA theme does not support Hugo version 0.54.0. Minimum version required is 0.55.0
5:36:10 PM: Building sites … Total in 52 ms
5:36:10 PM: Error: Error building site: logged 1 error(s)
5:36:10 PM: ​
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: β€œbuild.command” failed
5:36:10 PM: ────────────────────────────────────────────────────────────────
5:36:10 PM: ​
5:36:10 PM: Error message
5:36:10 PM: Command failed with exit code 255: hugo
5:36:10 PM: ​
5:36:10 PM: Error location
5:36:10 PM: In Build command from Netlify app:
5:36:10 PM: hugo
5:36:10 PM: ​
5:36:10 PM: Resolved config
5:36:10 PM: build:
5:36:10 PM: command: hugo
5:36:10 PM: commandOrigin: ui
5:36:10 PM: publish: /opt/build/repo/public
5:36:10 PM: Caching artifacts
5:36:10 PM: Started saving build plugins
5:36:10 PM: Finished saving build plugins
5:36:10 PM: Started saving pip cache
5:36:10 PM: Finished saving pip cache
5:36:10 PM: Started saving emacs cask dependencies
5:36:10 PM: Finished saving emacs cask dependencies
5:36:10 PM: Started saving maven dependencies
5:36:10 PM: Finished saving maven dependencies
5:36:10 PM: Started saving boot dependencies
5:36:11 PM: Finished saving boot dependencies
5:36:11 PM: Started saving rust rustup cache
5:36:11 PM: Finished saving rust rustup cache
5:36:11 PM: Started saving rust cargo bin cache
5:36:11 PM: Finished saving rust cargo bin cache
5:36:11 PM: Started saving go dependencies
5:36:11 PM: Finished saving go dependencies
5:36:13 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:36:13 PM: Failing build: Failed to build site
5:36:13 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
5:36:13 PM: Finished processing build request in 12.682555754s

Yes, it does. I’d recommend using the latest version (currently 0.80.0), but you can choose to stay with 0.55.0 as well. Just add an environment variable in your Netlify UI named HUGO_VERSION and value as 0.55.0 or any other valid version number.

That did the trick. Thanks @hrishikesh for putting me on the right path :thank_you:

1 Like