# "Module not Found..."

**URL:** <https://discourse.gohugo.io/t/module-not-found/22067>\
**Category:** support\
**Created:** [November 30, 2019, 11:07am UTC](https://discourse.gohugo.io/t/module-not-found/22067 "2019-11-30T11:07:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![HenrySkup](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/henryskup/32/8183_2.png) [@HenrySkup](https://discourse.gohugo.io/u/HenrySkup)\
**Post date:** [November 30, 2019, 11:07am UTC](https://discourse.gohugo.io/t/module-not-found/22067/1 "2019-11-30T11:07:00Z")

</div>

I’m trying to figure this out and would appreciate any feed back. Basically, I’m moving stuff to repos, and also trying to be more HUGO MODular, but have run into some strange behavior.

I have a repo which will be the main content repo (AKA “the website”). This repo pulls in a theme via mods from a local folder (I know that routing the theme locally rather than via github will be faster/easier for rapid development).

So my main `site/config.yml` file looks like:

```auto
...

themesDir : ../ #theme folder lives above

module :
  imports :
    - path : hugo-theme

...

```

So far, so good (this repo also has a `go.mod` and `go.sum` file.

“Hugo-Theme” is a repo with a `go.mod` and `go.sum` file as well as a `config.yml` file where I want to pull some dependencies.

In the past I have used Hugo Mods to pull some JS libraries from Github – I use this fro my dependency management. It seems to work well (at least for my use cases).

So, within `hugo-theme/config.yml` it looks like this:

```auto
module :
  imports :
    - disable : false
      path : github.com/processing/p5.js-website
      mounts :
        - source : src/assets/js/
          target : assets/js/vendor

```

And, within `hugo-theme/layouts/index.html` I have:

```auto
{{- $p5 := resources.Get "js/vendor/p5.min.js" -}}
{{- with $p5 -}}<script src="{{ .Permalink }}"></script>{{- end -}}

```

* * *

When I run the site I get the following readout:

```auto
$ hugo serve -D --disableFastRender
hugo: downloading modules …
go: finding github.com/processing/p5.js-website latest
go: downloading github.com/processing/p5.js-website v0.0.0-20191128063215-f4e4dec930b8
go: extracting github.com/processing/p5.js-website v0.0.0-20191128063215-f4e4dec930b8
hugo: collected modules in 53101 ms
Error: module "github.com/processing/p5.js-website" not found; either add it as a Hugo Module or store
 it in "/.../Documents/GitHub".: module does not exist

```

Hmmmmmmm…

and the thing is: it all works when the module is listed and imported when it is the in the main `site/config.yml`.

I’m not sure whats happening… thoughts?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [November 30, 2019, 12:01pm UTC](https://discourse.gohugo.io/t/module-not-found/22067/2 "2019-11-30T12:01:55Z")

</div>

Check whether there is some difference in the generated hash between earlier and recent versions of Hugo.

I encountered the “Module not found” error in a theme submission at the Hugo Themes repo, more here: [https://github.com/gohugoio/hugoThemes/issues/713#issuecomment-557814781](https://github.com/gohugoio/hugoThemes/issues/713#issuecomment-557814781)

---

<div class="post-metadata">

**Author:** ![HenrySkup](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/henryskup/32/8183_2.png) [@HenrySkup](https://discourse.gohugo.io/u/HenrySkup)\
**Post date:** [December 2, 2019, 6:52am UTC](https://discourse.gohugo.io/t/module-not-found/22067/3 "2019-12-02T06:52:07Z")

</div>

so I just read this: [Kodify · Programming articles and code tutorials](https://kodify.net/hugo/theme/config-theme-toml-difference/)

Which says:

> The `config.toml` file that’s included with most themes (usually in the theme’s `/exampleSite/` folder) contains the theme’s **example settings**. This file is not a configuration file and does _not_ affect Hugo’s behaviour (and we can even safely delete it). We use a theme’s `config.toml` file only to see what theme settings we should include in our configuration file and the values those options accept.

Is this true? I could understand it not being used if within the `/exampleSite/` folder, but if it is a top-level `config` file, I would assume that it would be folded into the site’s config ?

(I’ll also check on those hashes…)

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 2, 2019, 7:05am UTC](https://discourse.gohugo.io/t/module-not-found/22067/4 "2019-12-02T07:05:36Z")

</div>

> [@HenrySkup](#):
>
> Is this true? I could understand it not being used if within the `/exampleSite/` folder, but if it is a top-level `config` file, I would assume that it would be folded into the site’s config ?

The quote you linked to is from 2017.

Since [Allow some config from themes by bep · Pull Request #4514 · gohugoio/hugo · GitHub](https://github.com/gohugoio/hugo/pull/4514) was merged in 2018, config files directly under the root of `/theme/` gained the following functionality:

> This allows a config.toml in the theme to set
> 
> 1. `params` (but cannot override params in project. Will also get its own “namespace”, i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key.
> 2. `menu` – but cannot redefine/add menus in the project. Must create its own menus with its own identifiers.
> 3. `languages` – only `params` and `menu` . Same rules as above.
> 4. **new** `outputFormats`
> 5. **new** `mediaTypes`

The config under `/exampleSite/` does indeed refer to the exampleSite project and as such it is not inherited by a project that uses its parent theme.

But the config under the root of a theme is inherited by a project that uses this theme.

The config under the root of a Hugo project can override the config of a theme, but not the other way around.

* * *

cc: @bep

---

<div class="post-metadata">

**Author:** ![HenrySkup](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/henryskup/32/8183_2.png) [@HenrySkup](https://discourse.gohugo.io/u/HenrySkup)\
**Post date:** [December 2, 2019, 7:10am UTC](https://discourse.gohugo.io/t/module-not-found/22067/5 "2019-12-02T07:10:25Z")

</div>

Cool, just making sure. 👍

---

<div class="post-metadata">

**Author:** ![HenrySkup](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/henryskup/32/8183_2.png) [@HenrySkup](https://discourse.gohugo.io/u/HenrySkup)\
**Post date:** [December 2, 2019, 11:12am UTC](https://discourse.gohugo.io/t/module-not-found/22067/6 "2019-12-02T11:12:04Z")

</div>

Hashes look good ( i think? )

And now I’m getting the following error…

```auto
go get .: path /Users/.../Documents/GitHub/hugo-theme is not a package in module rooted at /Users/.../Documents/GitHub/hugo-theme

```

doe this help clarify the issue?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 2, 2019, 11:35am UTC](https://discourse.gohugo.io/t/module-not-found/22067/7 "2019-12-02T11:35:39Z")

</div>

> [@HenrySkup](#):
>
> doe this help clarify the issue?

Actually I am probably not the best in debugging Go(aka Hugo) modules.

but let’s give this a try. What is the Go version installed locally?

Try issuing the command `go get -v` with the `-v` flag that is.

Did the module mount?

If not you may need to provide access to your project for us to have a look locally.

---

<div class="post-metadata">

**Author:** ![HenrySkup](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/henryskup/32/8183_2.png) [@HenrySkup](https://discourse.gohugo.io/u/HenrySkup)\
**Post date:** [December 3, 2019, 10:02am UTC](https://discourse.gohugo.io/t/module-not-found/22067/8 "2019-12-03T10:02:11Z")

</div>

let me make a set of “clean repos”, see if i can’t reproduce, and then i’ll share with all.

---

<div class="post-metadata">

**Author:** ![mdashx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mdashx/32/11790_2.png) [@mdashx](https://discourse.gohugo.io/u/mdashx)\
**Post date:** [December 27, 2019, 11:29pm UTC](https://discourse.gohugo.io/t/module-not-found/22067/9 "2019-12-27T23:29:20Z")

</div>

I get the same error when using a theme via modules. I have no problem getting the theme working, but when I try to run `hugo mod get -u`, I get that error message referring to my project path.

```auto
tom@ladybird exampleSite$ hugo mod get -u
go get .: path /mnt/c/Users/Tom/Sync/home/exampleSite is not a package in module rooted at /mnt/c/Users/Tom/Sync/home/exampleSite

```

I’m reading all I can about Go modules, but I’d definitely appreciate being pointed in the right direction so I can figure this out faster.

I followed the steps here: [Hugo modules for "dummies"](https://discourse.gohugo.io/t/hugo-modules-for-dummies/20758) and then I get the error when trying to update modules.

`go version go1.13.4 linux/amd64`

---

<div class="post-metadata">

**Author:** ![craftsmandigital](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/craftsmandigital/32/9556_2.png) [@craftsmandigital](https://discourse.gohugo.io/u/craftsmandigital)\
**Post date:** [December 28, 2019, 11:06am UTC](https://discourse.gohugo.io/t/module-not-found/22067/10 "2019-12-28T11:06:40Z")

</div>

The quick and dirty way to update modules is to delete your go.mod and go.sum files and run the command  
hugo mod init [described on this link](https://craftsmandigital.net/blog/hugo-modules/#updating-modules)  
The problem with this solution is that it would pull in all your latest updates from all connected modules.

---

<div class="post-metadata">

**Author:** ![mdashx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mdashx/32/11790_2.png) [@mdashx](https://discourse.gohugo.io/u/mdashx)\
**Post date:** [December 28, 2019, 2:22pm UTC](https://discourse.gohugo.io/t/module-not-found/22067/11 "2019-12-28T14:22:45Z")

</div>

Thanks, that’s what I’ve done, and I also realize you can update modules individually and that has worked fine for me too. But I’d really like to know what is going on with this error. I guess I just have to learn more about Go Modules.

Maybe the error is because there are no Go packages in my directory that makes up my Hugo site?

---

<div class="post-metadata">

**Author:** ![cshoredaniel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cshoredaniel/32/19684_2.png) [@cshoredaniel](https://discourse.gohugo.io/u/cshoredaniel)\
**Post date:** [March 4, 2020, 9:59pm UTC](https://discourse.gohugo.io/t/module-not-found/22067/12 "2020-03-04T21:59:45Z")

</div>

Ok, I figured out why the problem occurs. I had the same problem when adding another module. The issue was that one can’t use the new go.mod / go.sum from the _theme_ in exampleSite until the theme can be found by go get.

There are two possible solutions:

1. Push the _theme_ then update exampleSite
2. Use the development option to replace a module in go.sum / go.mod with a local path for development (but don’t forget to remove that config before committing and pushing). [https://gohugo.io/hugo-modules/use-modules/#make-and-test-changes-in-a-module](https://gohugo.io/hugo-modules/use-modules/#make-and-test-changes-in-a-module) has the basic information.

In a working scenario my _theme_ go.mod looks like:

```
 module github.com/cshoredaniel/new-oldnew-mashup

go 1.13

require (
        github.com/cshoredaniel/julmot-mark.js v0.0.0-20181210172629-31a7315c6024 // indirect
        github.com/cshoredaniel/necolas-normalize.css v2.1.3+incompatible // indirect
        github.com/cshoredaniel/plainfuse v0.0.0-20200304153200-190c16c2024d // indirect
)

replace github.com/cshoredaniel/new-oldnew-mashup => /home/daniel/devpath/new-oldnew-mashup

```

and my exampleSite go.mod looks like:

```
module github.com/cshoredaniel/new-oldnew-mashup-example

go 1.13

require (
        github.com/cshoredaniel/julmot-mark.js v0.0.0-20181210172629-31a7315c6024 // indirect
        github.com/cshoredaniel/necolas-normalize.css v2.1.3+incompatible // indirect
        github.com/cshoredaniel/plainfuse v0.0.0-20200304153200-190c16c2024d // indirect
)

replace github.com/cshoredaniel/new-oldnew-mashup => /home/daniel/devpath/new-oldnew-mashup

replace github.com/cshoredaniel/new-oldnew-mashup-example => /home/daniel/devpath/new-oldnew-mashup/exampleSite

```

Note that when actually committing `module github.com/cshoredaniel/new-oldnew-mashup-example` is `module github.com/cshoredaniel/new-oldnew-mashup` is the exampleSite go.mod.

Hope that helps someone who runs across the same issue.

---

<div class="post-metadata">

**Author:** ![mdashx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mdashx/32/11790_2.png) [@mdashx](https://discourse.gohugo.io/u/mdashx)\
**Post date:** [July 3, 2020, 12:47pm UTC](https://discourse.gohugo.io/t/module-not-found/22067/13 "2020-07-03T12:47:20Z")

</div>

Thanks for the info. I will experiment with it sometime soon. For now I just went back to using Git submodules to install themes.
