"module not found" and "module does not exist" error since >=0.112.0

Hi there,

When I deploy my static blog using latest version of Hugo Extended (>=0.112.0) to Netlify, Cloudflare Pages and when I’m using GitHub Actions to deploy, I get error with following messages:

Error: failed to load modules: module "../../stack-modified" not found in "/opt/build/stack-modified"; either add it as a Hugo Module or store it in "/opt/build/repo/themes".: module does not exist

But, when I’m execute hugo server --gc and hugo --gc command on my computer (with Windows 10 and Hugo Extended 0.112.0), I don’t encounter any issues so far.

There is my public repository: GitHub - FarrelF/Blog: Kode Sumber dari Farrel Franqois Blog yang dibuat dengan Hugo, berbasis Go

The following is my build logs:

Is this bug? Or, is there something wrong with the configuration? I don’t change anything in my configuration file, themes and my modified themes, so I can’t figured out of this issue.

When I downgrade it to 0.111.3, I don’t encounter any issue or errors from Netlify, Cloudflare Pages and GitHub Actions when build and deploying my static blog, the process went smoothly as it should.

Yes, in v0.112.0 and later. It fails locally for me, and works with v0.111.3. I’ll create an issue; stick with v0.111.3 for now.

1 Like
├── _default/
│   ├── config.toml
│   ├── menu.toml
│   ├── module.toml
│   └── params.toml
├── development/
│   ├── module.toml  <-- BUG: this is read when running `hugo`
│   └── server.toml
├── production/
│   ├── config.toml
│   └── params.toml
└── README.md


replacements = "github.com/FarrelF/stack-modified -> ../../stack-modified"

On my local machine I don’t have the replacement as specified above.

$ hugo server
Error: command error: failed to load modules: module "../../stack-modified" not found in...

$ hugo
Error: failed to load modules: module "../../stack-modified" not found in...

$ hugo server -e production   # no console error

$ hugo -e production   # no console error

Seems related to https://github.com/gohugoio/hugo/issues/11006

1 Like

When I upgrade it to 0.112.2 (which causes GitHub Issue #11006 closed) without adding -e production, I still encounter the same error message when deploying to Netlify, it seems that Hugo still have these bug and doesn’t yet respecting HUGO_ENV environment variable that I set it to production?

There is my build log: Netlify App

But, thank you for the temporary solution, it works when I add -e production to production build command and my site works without any problem after that :slightly_smiling_face:

I’ve created a new issue:

1 Like

Resolved with https://github.com/gohugoio/hugo/releases/tag/v0.112.3.

1 Like

A post was split to a new topic: Integration of Google Sheets API

Yes, I can confirm that this latest version (0.112.3) is working very well, without any console errors, so I don’t need to add the -e production argument anymore.

Thank you @jmooring and @bep for resolving this issue :blush:


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.