"module not found" and "module does not exist" errors

My module’s config.yaml:

module:
  hugoVersion:
    min: "0.101.0"
    extended: true
  imports:
  - path: "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"

After I run hugo mod tidy, go.mod is:

module github.com/willfaught/paige

go 1.19

require (
	github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20200.20101 // indirect
)

hugo mod get -u ./… just says:

Update module in /Users/Will/Developer/paige

Great.

But when I run hugo server, I get:

Error: module "github.com/gohugoio/hugo-mod-bootstrap-scss/v5" not found; either add it as a Hugo Module or store it in "/Users/Will/Developer".: module does not exist

What am I doing wrong? I can’t figure it out after much head scratching. I figured this would be a common error, but couldn’t find another post quite like this one.

I originally encountered this error when importing Bootstrap, Bootstrap Icons, and Katex:

module:
  hugoVersion:
    min: "0.101.0"
    extended: true
  imports:
  - path: "github.com/twbs/bootstrap"
  - path: "github.com/twbs/icons"
  - path: "github.com/katex/katex"

It complained about all those imports being missing too.

❯ hugo env
hugo v0.111.2+extended darwin/amd64 BuildDate=unknown
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.20.1"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"
github.com/sass/dart-sass-embedded/protocol="1.2.0"
github.com/sass/dart-sass-embedded/compiler="1.59.2"
github.com/sass/dart-sass-embedded/implementation="1.59.2"

I assume that you’re running the hugo server on exampleSite, if so, you should initial the module for the exampleSite as well (not tested).

cd exampleSite
hugo mod init github.com/willfaught/paige/exampleSite
hugo server --themesDir=../../

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