Cannot get a public module from github on OSX

I’ve added a public module to my config.toml,

    path = ""

Then invoke this to download a module,

hugo mod get -u

And I get the following warning message with no changes made,

WARN 2022/11/15 00:44:37 module “” not found; either add it as a Hugo Module or store it in “/Users/johnbonjovi/John/web/hugo-blog/themes”.: module does not exist

Need your help! :pray:

System parameters:

  • macOS Ventura, Version 13.0.1 (22A400)
  • hugo v0.105.0-0e3b42b4a9bdeb4d866210819fc6ddcf51582ffa+extended darwin/amd64 BuildDate=2022-10-28T12:29:05Z VendorInfo=gohugoio

Did you do this first, in the root of your project directory?

hugo mod init foo/bar

My understanding that this is only needed when creating a new module. Which is not my case.

The command hugo mod init creates two files go.mod and go.sum both of which already exist in the package on GitHub.

You need to initialize your project (web site) as a Hugo module to import another Hugo module.

Ah, I see…

Strangely, when I do hugo mod init hugo-blog in the root directory of my project (i.e. from within /Users/johnbonjovi/John/web/hugo-blog), I get very similar error message as above,

WARN 2022/11/15 14:05:18 module “” not found; either add it as a Hugo Module or store it in “/Users/johnbonjovi/John/web/hugo-blog/themes”.: module does not exist
go: creating new go.mod: module hugo-blog
go: to add module requirements and sums:
go mod tidy

Finally, I have solved it. :slightly_smiling_face:

As jmooring pointed out above, the very first thing has to be hugo mod init foo/bar. Otherwise nothing will work!! So I started everything from scratch and sequence of instructions as follows,

  1. Change directory to your website parent folder,
    cd /Users/johnbonjovi/John/web/hugo-blog/

Import note: make sure your config.toml does NOT contain active [module] or any [[module.imports]] sections. Else these instructions will fail.

  1. From within that directory, initiate the website folder as module
    hugo mod init hugo-blog

  2. Edit your config.toml, and add the [module] section, e.g.

    path = ""
  1. You can get the latest version from GitHub by invoking,

hugo mod get

And this is it. Thanks, jmooring!

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