-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
What version of Hugo are you using (hugo version
)?
$ hugo version 0.151.0
Does this issue reproduce with the latest release?
Yes.
TLDR description
When using a config like this:
$ cat hugo.yml
baseURL: 'https://example.org/'
languageCode: 'en-us'
title: 'My New Hugo Site'
module:
imports:
- path: github.com/adityatelange/hugo-PaperMod
version: v8.0
hugo serve
will crash saying:
Error: command error: failed to load modules: failed to download module github.com/adityatelange/[email protected]: failed to execute 'go [mod download -json github.com/adityatelange/[email protected]]': failed to execute binary "go" with args [mod download -json github.com/adityatelange/[email protected]]: *errors.errorString
Steps to reproduce
mkdir example
docker run -it --rm -p 1313:1313 -v .:/project ghcr.io/gohugoio/hugo:v0.150.1 new site example
cd example
mv hugo.toml hugo.yml
, then edit the file and change it into yaml, just because I prefer working with yaml.docker run -it --rm -p 1313:1313 -v .:/project ghcr.io/gohugoio/hugo:v0.150.1 mod init example
- Add an import to the config with a
version
key, so that the whole file looks like this:
baseURL: 'https://example.org/'
languageCode: 'en-us'
title: 'My New Hugo Site'
module:
imports:
- path: github.com/adityatelange/hugo-PaperMod
version: v8.0
docker run -it --rm -p 1313:1313 -v .:/project ghcr.io/gohugoio/hugo:v0.150.1 serve --bind 0.0.0.0
I expect step 7 to download/install the module and serve the website, but instead I get this error:
Error: command error: failed to load modules: failed to download module github.com/adityatelange/[email protected]: failed to execute 'go [mod download -json github.com/adityatelange/[email protected]]': failed to execute binary "go" with args [mod download -json github.com/adityatelange/[email protected]]: *errors.errorString
- Just to narrow down the scope of the problem, comment out the
version
key in the yaml config and run theserve
command again, and it works as expected.
And just to confirm that the v8.0
tag of this module does exist, it's here: https://github.com/adityatelange/hugo-PaperMod/releases/tag/v8.0
A short note about the context of why I'm pinning this version
I build my site by way of GitHub Actions, so I can't rely on installing modules locally and expecting modules to remain at the same version on my local hard drive. If I build my site using v8.0 of a given module today in September 2025, I want to be able to walk away from the blog and come back to it 3 years later and push another commit and be sure that I'm still using the same dependencies/versions in 2028 as I used in 2025. I don't want a breaking change in my theme to break my site unless I have explicitly updated the version pin for the theme.
Links
Related issue: #13964
Related commit: 747cf4a (presumably)
Related author: @bep
Thanks for all your efforts on this great project.