Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: no matching versions for query "upgrade" when trying to install/use theme #791

Open
kmpm opened this issue Nov 10, 2024 · 5 comments · May be fixed by kmpm/gohugo-theme-ananke#1
Open
Assignees

Comments

@kmpm
Copy link

kmpm commented Nov 10, 2024

When following the instructions for how to install this theme using the module method I get an error about not being able to get the module.

Note: I cannot run hugo config --format toml to get the config because this generates the same error so I just pasted the config instead.

Expected Behavior

hugo server -D

...

Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) 
Press Ctrl+C to stop

Current Behavior

hugo server -D
go: no module dependencies to download
go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 848 ms
Hugo provides its own webserver which builds and serves the site.

...

Error: command error: failed to load modules: failed to get ["github.com/theNewDynamic/gohugo-theme-ananke@upgrade"]: failed to execute 'go [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]': failed to execute binary "go" with args [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]: go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
 *errors.errorString

Just for good measure I tried hugo mod get as well.

$ hugo mod get -u github.com/theNewDynamic/gohugo-theme-ananke
go: no module dependencies to download
go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 902 ms
Error: failed to load modules: failed to get ["github.com/theNewDynamic/gohugo-theme-ananke@upgrade"]: failed to execute 'go [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]': failed to execute binary "go" with args [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]: go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
 *errors.errorString

Possible Solution

Steps to Reproduce

  1. hugo new site quickstart
  2. cd quickstart
  3. go mod init quickstart
  4. echo 'theme = ["github.com/theNewDynamic/gohugo-theme-ananke"]' >> hugo.toml
  5. hugo server -D

The bigger picture (we need context)

Running this on a Raspberry Pi 5 with latest RaspiOS updated todady (debian 12.

$ hugo version
hugo v0.138.0+extended linux/arm64 BuildDate=unknown

$ go version
go version go1.22.8 linux/arm64

$ hugo mod graph
# returns nothing

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

$ uname -a
Linux kmpm-pi-a3c244 6.6.58-v8-16k+ #1809 SMP PREEMPT Wed Oct 23 11:55:28 BST 2024 aarch64 GNU/Linux

$ hugo config --format toml
go: no module dependencies to download
go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 863 ms
Error: failed to load modules: failed to get ["github.com/theNewDynamic/gohugo-theme-ananke@upgrade"]: failed to execute 'go [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]': failed to execute binary "go" with args [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]: go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
 *errors.errorString
Hugo Config

baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
theme = ["github.com/theNewDynamic/gohugo-theme-ananke"]

@homerhanumat
Copy link

I'm seeing this error too on MacOS.

@davidsneighbour
Copy link
Collaborator

Ananke v1 had no module setup. v2 has since v2.11.1. You need to use

hugo mod get github.com/theNewDynamic/gohugo-theme-ananke/v2

See https://github.com/theNewDynamic/gohugo-theme-ananke/releases/tag/v2.11.1 for some details. The docs need updating.

Other than that, this is a limitation in the way Go does versioning. v0 and v1 require only the path, from v2 on the path needs a version string with the major version at the end.

You could also use a commit hash like this: github.com/theNewDynamic/gohugo-theme-ananke@1234567 but this will probably be overridden next time you call to hugo mod get -u ./....

@kmpm
Copy link
Author

kmpm commented Nov 11, 2024

@davidsneighbour go works in mysterious ways sometimes but how would that explain that I do get the exact same error when trying v2 as described in the release descriptions

$ hugo mod get github.com/theNewDynamic/gohugo-theme-ananke/v2
go: no module dependencies to download
go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 903 ms
Error: failed to load modules: failed to get ["github.com/theNewDynamic/gohugo-theme-ananke@upgrade"]: failed to execute 'go [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]': failed to execute binary "go" with args [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]: go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
 *errors.errorString

edit: same with commit hash

$ hugo mod get github.com/theNewDynamic/gohugo-theme-ananke@892eaf2
go: no module dependencies to download
go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
hugo: collected modules in 848 ms
Error: failed to load modules: failed to get ["github.com/theNewDynamic/gohugo-theme-ananke@upgrade"]: failed to execute 'go [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]': failed to execute binary "go" with args [get github.com/theNewDynamic/gohugo-theme-ananke@upgrade]: go: github.com/theNewDynamic/gohugo-theme-ananke@upgrade: no matching versions for query "upgrade"
 *errors.errorString

@kmpm
Copy link
Author

kmpm commented Nov 11, 2024

Oh... the theme setting in hugo.toml must be changed as well.
theme = ["github.com/theNewDynamic/gohugo-theme-ananke/v2"]
otherwise it doesn't matter what arguments I give to hugo mod get

@davidsneighbour
Copy link
Collaborator

yes. I also think that hugo mod get is not required to install the module, because Hugo will load the module based on the config the next time you start it. hugo mod get is helpful if you want to force a specific version or hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants