Skip to content

Commit

Permalink
modules: Add some help text to the 'unknown revision' error
Browse files Browse the repository at this point in the history
I had a head scratching moment with this myself, so it's safe to say that others will.

See gohugoio#6825
  • Loading branch information
bep committed Sep 17, 2021
1 parent 268e306 commit 1cabf61
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,14 @@ func (c *Client) runGo(

if strings.Contains(stderr.String(), "invalid version: unknown revision") {
// See https://github.com/gohugoio/hugo/issues/6825
c.logger.Println(`hugo: you need to manually edit go.mod to resolve the unknown revision.`)
c.logger.Println(`An unknown resivion most likely means that someone has deleted the remote ref (e.g. with a force push to GitHub).
To resolve this, you need to manually edit your go.mod file and replace the version for the module in question with a valid ref.
The easiest is to just enter a valid branch name ther, e.g. master, which would be the what you put in place of 'v0.5.1' in the example below.
require github.com/gohugoio/hugo-mod-jslibs/instantpage v0.5.1
If you then run 'hugo mod graph' it should resolve itself to the most recent version (or commit if no semver versions).`)
}

_, ok := err.(*exec.ExitError)
Expand Down

0 comments on commit 1cabf61

Please sign in to comment.