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.
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.
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
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?
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
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