Trying to use BootStrap as a module

Hello,

Following the instructions here: GitHub - gohugoio/hugo-mod-bootstrap-scss: Packages Bootstrap SCSS (v4 and v5) as a Hugo Module

I am getting the following error, when running the command hugo mod get -u github.com/twbs/bootstrap

module "github.com/gohugoio/hugo-mod-bootstrap-scss/v5" not found; either add it as a Hugo Module or store

It seems that none of these directories is available:

github.com/gohugoio/hugo-mod-bootstrap-scss/v4
github.com/gohugoio/hugo-mod-bootstrap-scss/v5

Can I use these one instead? And if so, how to modify the initial command to get it to download these directories? Thanks!

github.com/gohugoio/hugo-mod-bootstrap-scss-v4
github.com/gohugoio/hugo-mod-bootstrap-scss-v5
$ hugo version
hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended windows/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio

That is the one you want to use.

To use the above module you need to initialize your own project as a Hugo module. I just tested this:

hugo new site foo
cd foo
hugo mod init foo

And then add this to config.toml:

[module]
    [[module.imports]]
        path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"

I tried that. But this URL returns a 404:

WARN 2023/01/17 11:43:52 module "github.com/gohugoio/hugo-mod-bootstrap-scss/v5" not found; either add it as a Hugo Module or store it in "C:\\dev\\hugo\\foo\\themes".: module does not exist

That’s not a URL, it’s a path to a Go Module. The error message you get isn’t the best, I agree, but it usually indicates that you haven’t set up your project as a Hugo Module.

Ok, it works now.

1 Like

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