Not able to build exampleSite with Hugo

I have been trying to build my site with different ways yet I fail to know how to make it work, on my local environment I can do cd exampleSite && hugo --themesDir …/… yet on Netlify it fails.

10:54:24 AM: Verify run directory
10:54:26 AM: ​
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM:   Netlify Build                                                 
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM: ​
10:54:26 AM: ❯ Version
10:54:26 AM:   @netlify/build 26.0.2
10:54:26 AM: ​
10:54:26 AM: ❯ Flags
10:54:26 AM:   baseRelDir: true
10:54:26 AM:   buildId: 61c5fb39faeddf0007e171bc
10:54:26 AM:   deployId: 61c5fb39faeddf0007e171be
10:54:26 AM: ​
10:54:26 AM: ❯ Current directory
10:54:26 AM:   /opt/build/repo
10:54:26 AM: ​
10:54:26 AM: ❯ Config file
10:54:26 AM:   /opt/build/repo/netlify.toml
10:54:26 AM: ​
10:54:26 AM: ❯ Context
10:54:26 AM:   production
10:54:26 AM: ​
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM:   1. build.command from netlify.toml                            
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM: ​
10:54:26 AM: $ cd exampleSite && hugo --minify --themesDir ../..
10:54:26 AM: Error: module "Hugo-Doodle" not found; either add it as a Hugo Module or store it in "/opt/build".: module does not exist
10:54:26 AM: Total in 0 ms
10:54:26 AM: ​
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM:   "build.command" failed                                        
10:54:26 AM: ────────────────────────────────────────────────────────────────
10:54:26 AM: ​
10:54:26 AM:   Error message
10:54:26 AM:   Command failed with exit code 255: cd exampleSite && hugo --minify --themesDir ../..
10:54:26 AM: ​
10:54:26 AM:   Error location
10:54:26 AM:   In build.command from netlify.toml:
10:54:26 AM:   cd exampleSite && hugo --minify --themesDir ../..
10:54:26 AM: ​
10:54:26 AM:   Resolved config
10:54:26 AM:   build:
10:54:26 AM:     command: cd exampleSite && hugo --minify --themesDir ../..
10:54:26 AM:     commandOrigin: config
10:54:26 AM:     environment:
10:54:26 AM:       - HUGO_BASEURL
10:54:26 AM:       - HUGO_VERSION
10:54:26 AM:       - HUGO_THEME
10:54:26 AM:     publish: /opt/build/repo/exampleSite/public
10:54:26 AM:     publishOrigin: config

Here is my netlify.toml:

[build]
command = "cd exampleSite && hugo --minify --themesDir ../.."
publish = "exampleSite/public"

[build.environment]
HUGO_BASEURL = "https://Hugo-Doodle.netlify.app"
HUGO_THEME = "Hugo-Doodle"
HUGO_VERSION = "0.90.1"

Here is my repo: GitHub - 1hiking/Hugo-Doodle: A Hugo theme based on DoodleCSS

Hi @Hiking,

Shouldn’t the --themesDir be ../? I wonder why you’re going 2 levels up.

Hello,
I’m using …/… since a lot of posts made in the pasthave been using that method, it also works on my local machine.
The good thing: The path is now correct :smiley: thank you

The bad part: “Error: module “Hugo-Doodle” not found; either add it as a Hugo Module or store it in “/opt/build/repo”.: module does not exist”

Interesting. Well, did you give this a read:

It shows ways on how to use the theme in the exampleSite folder.

I tried them all (except symlinks since I am on Windows) and I still get the same error on the console yet they all work locally. :confused:

Edit: I have now this PR to track my issue :B Make Netlify deploy by 1hiking · Pull Request #1 · 1hiking/Hugo-Doodle · GitHub

Hey @Hiking,

This appears to be a problem with how Hugo is working on Ubuntu. Netlify’s build containers run on Ubuntu and I was able to get it working fine on macOS. But, when I tried in a clean Ubuntu VM, it fails with the same error. I think you should try posting this question on Hugo forums on how to tackle this situation.