Trouble with hugo modules

PLEASE help us help you by writing a good post!

Netlify site name: pensive-edison-65538e
Preview build off a branch: pensive-edison-65538e/deploys/60635b2fcdcda80008025448

Looking through the other topics with a similar error helped some, and I believe I have added the module correctly, but I keep getting:

Error: module “hugo-shortcode-gallery” not found; either add it as a Hugo Module or store it in “/opt/build”.: module does not exist

Anyone have a troubleshooting routine to go through on this?

Thanks!

Would you be able to provide a repo to look at? Even a test repo with dummy content would do.

Here is the PR:

I think, you’re trying to do this:

[module]
  [[module.imports]]
    path = "git repo of the gallery component"

You’ve currently added it as a theme and it doesn’t exist in your repo (in the themes or any folder).

I have updated the PR to have the url of the repo in there, and I still get the same error.

As the documentation on the gallery component says:

Clone this git repository into your themes folder. git clone https://github.com/mfg92/hugo-shortcode-gallery.git

Next edit your projects config.toml and add this theme component to your themes.

Seems like, previously, you just imported it as a theme without actually adding it to the themes folder. Even no, you’re using git submodules instead of Hugo modues.

I think, you need to add this to your theme.toml:

[module]
  [[module.imports]]
    path = "https://github.com/mfg92/hugo-shortcode-gallery"

ok. I cloned into a themes folder I created as there wasnt one in the directory. It gave me a warning about using a submodule as a clone wouldnt know what to do there.

I did update the .gitmodules to install to path = themes/module and I updated the theme.toml. I also updated the path in the config.toml

Can you take a look at that setup and see what I could be doing wrong? I am still getting the same error.

Error: module “github.com/mfg92/hugo-shortcode-gallery” not found; either add it as a Hugo Module or store it in “/opt/build”.: module does not exist

Thanks, sorry to be so dense.

Sure, I’ll check that. However, it’ll have to wait till morning. It’s past midnight here. Meanwhile, you can get a faster response on Hugo forums (discourse.gohugo.io).

thanks for the help, I appreciate it. Cheers!

I just tried this and I could build without error, however, my setup might be wrong.

Here’s my repo: GitHub - Hrishikesh-K/modules

So, I created a new Hugo website with a config.toml, added your repo to the themes folder with the name abc. In your folder, I added another themes folder with the shortcode in it and added it to your theme.toml. The build works without any error. Could you please check if it works for you too?

The master branch, which looks like your repo is built from, builds fine. The problem occurs when I try to put in that gallery shortcode. But perhaps refactoring the directory structure as you have done there will help it work. I will give it a try. Thanks for the help.