Site -> theme as a module -> another module: module not found; either add it as a Hugo Module or store it in

Hello,

I have this setup:

I tagged the tailwind module with v0.0.1. In my theme module, I added the tailwind module in this commit:

So far so good. Now, I added that commit my site setup using the command:

$ hugo mod get github.com/ringods/hugo-theme-blog@cd9c3cbcb13d91b4271b540241584f09a08d8df4

which results in this commit:

But when I want to generate my site, I still get this error:

$ hugo
Error: module "github.com/ringods/hugo-tailwindcss@v0.0.1" not found; either add it as a Hugo Module or store it in "/Users/ringods/Projects/personal/ringo_de_smet_name/themes".: module does not exist
Total in 52 ms

I must be overlooking a detail here, but I don’t understand what I am missing. I tried numerous things, but all to no avail. Can someone pinpoint the problem?

I did this:

git clone --recurse-submodules https://github.com/ringods/ringo_de_smet_name
cd ringo_de_smet_name/
git checkout -b newlook 
hugo

And got this:

Start building sites … 
hugo v0.89.4-AB01BA6E+extended linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio

                   | EN  
-------------------+-----
  Pages            | 23  
  Paginator pages  |  2  
  Non-page files   |  8  
  Static files     |  6  
  Processed images |  0  
  Aliases          |  2  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 182 ms

Maybe clear your module cache?

See https://discourse.gohugo.io/t/hugo-module-failing/34457/2

@jmooring that is strange. On my machine, any hugo command errors on the module not found:

$ hugo mod clean --all
WARN 2021/12/02 07:34:23 module "github.com/ringods/hugo-tailwindcss@v0.0.1" not found; either add it as a Hugo Module or store it in "/Users/ringods/Projects/personal/ringo_de_smet_name/themes".: module does not exist
Error: from config: failed to resolve output format "REDIR" from site config

$ hugo config | grep cachedir
Error: module "github.com/ringods/hugo-tailwindcss@v0.0.1" not found; either add it as a Hugo Module or store it in "/Users/ringods/Projects/personal/ringo_de_smet_name/themes".: module does not exist

Given my hugo-tailwindcss module is not in an error state, I ran the config & cleanup commands from that “project”:

$ hugo config | grep cachedir
cachedir: "/var/folders/mp/9wctftz9039d4jdch0y48r780000gn/T/hugo_cache/"
$ hugo mod clean --all
Deleted 339 files from module cache.

Retrying running hugo in my site folder gives me this now:

$ hugo
hugo: downloading modules …
hugo: collected modules in 4157 ms
Error: module "github.com/ringods/hugo-tailwindcss@v0.0.1" not found; either add it as a Hugo Module or store it in "/Users/ringods/Projects/personal/ringo_de_smet_name/themes".: module does not exist
Total in 4159 ms
Time: 0h:00m:04s                                                                                                                                                          

Still no luck. This is hugo v0.89.4+extended darwin/amd64 BuildDate=unknown, installed via Homebrew on my Mac.

Ringo

Just for grins, do exactly what I did.

git clone --recurse-submodules https://github.com/ringods/ringo_de_smet_name
cd ringo_de_smet_name/
git checkout -b newlook 
hugo

@jmooring your git command does not checkout the latest on my remote newlook branch. Please use this to test my error:

git checkout -b newlook origin/newlook

You only created a local branch named newlook using the latest on main.

:man_facepalming: Finger memory. That’s enough for today.

2 Likes

I think I found the error myself: one can’t use version identifiers in the Hugo module config. I created this commit to fix it on my end for my theme module:

But I couldn’t get out of my error situation for the site, only using the hugo CLI commands. Trying to bump the version of my theme module didn’t work:

$ hugo mod get -u github.com/ringods/hugo-theme-blog
hugo: downloading modules …
hugo: collected modules in 5417 ms
WARN 2021/12/02 08:37:02 module "github.com/ringods/hugo-tailwindcss@v0.0.1" not found; either add it as a Hugo Module or store it in "/Users/ringods/Projects/personal/ringo_de_smet_name/themes".: module does not exist
Error: from config: failed to resolve output format "REDIR" from site config
Time: 0h:00m:06s                                       

I had to use the go CLI to force an update of my go.mod and go.sum files:

$ go get -u github.com/ringods/hugo-theme-blog
go: downloading github.com/ringods/hugo-theme-blog v0.0.0-20211202073249-5bfad786d7cf
go get: upgraded github.com/ringods/hugo-theme-blog v0.0.0-20211201190601-cd9c3cbcb13d => v0.0.0-20211202073249-5bfad786d7cf

After that, I could run hugo again:

hugo                                                                                    newlook ●  08:38:13
Start building sites … 
hugo v0.89.4+extended darwin/amd64 BuildDate=unknown
WARN 2021/12/02 08:38:30 [dnb/debug-0] Additional logging by dnb-org (see https://dnbql.netlify.app/log)
WARN 2021/12/02 08:38:30 [dnb/info-8] Unused hook available for `head-start` (see https://dnbql.netlify.app/hooks)
WARN 2021/12/02 08:38:30 calculating open graph data

                   | EN  
-------------------+-----
  Pages            | 30  
  Paginator pages  |  0  
  Non-page files   |  8  
  Static files     |  2  
  Processed images |  0  
  Aliases          |  1  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 164 ms

@bep the fact that I couldn’t get out of the error situation only using hugo CLI and had to fall back to the go CLI, can I consider that to be a bug? Should I create a GH issue for this?

hugo mod is supposed to be a wrapper of the go mod command.
Both should work the same, if not, then this should be reported as a bug, IMHO.

1 Like

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