雨果错误 - 当前主题不支持当前版本

8

我正在尝试构建我的Hugo网站,但是当我运行hugo check时,我看到以下错误日志:

ERROR: 2017/09/10 Current theme does not support Hugo version 0.14. Minimum version required is 0.18
ERROR: 2017/09/10 template: theme/_default/baseof.html:2: function "default" not defined
ERROR: 2017/09/10 template: redefinition of template "main"
ERROR: 2017/09/10 template: theme/_default/single.html:7: function "humanize" not defined
ERROR: 2017/09/10 template: redefinition of template "main"
ERROR: 2017/09/10 template: theme/_default/terms.html:12: function "relLangURL" not defined
ERROR: 2017/09/10 template: theme/index.html:6: function "default" not defined
ERROR: 2017/09/10 template: theme/partials/menu-contextual.html:12: function "humanize" not defined
ERROR: 2017/09/10 template: theme/partials/page-header.html:9: function "default" not defined
ERROR: 2017/09/10 template: theme/partials/site-footer.html:4: function "now" not defined
ERROR: 2017/09/10 template: theme/partials/site-header.html:1: function "default" not defined
ERROR: 2017/09/10 template: theme/partials/social-follow.html:5: function "dict" not defined
ERROR: 2017/09/10 template: theme/partials/summary.html:3: function "humanize" not defined
ERROR: 2017/09/10 template: theme/post/single.html:11: function "humanize" not defined
ERROR: 2017/09/10 template: redefinition of template "main"

它说我需要Hugo 0.18版本,但是当我运行sudo apt-get install hugo时,它告诉我:

hugo is already the newest version
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.

我很困惑为什么会出现这个错误。有人遇到过这个错误吗?知道如何解决吗?


请在您的问题中包含运行 hugo env 的输出。此外,这似乎与您添加到问题中的任何标签都没有关系,除了 hugo 标签。肯定不是 AWS 或 S3 标签相关的。 - Mark B
我忘了提到我正在EC2实例上运行,并在S3上部署网站。这就是为什么那些标签在那里的原因。此外,似乎hugo env不是一个支持命令。 - sgmm
这似乎与您实际遇到的问题无关。您似乎正在运行Hugo 0.14,这是一个旧版本,并且“upgrade”命令似乎不起作用。我建议您前往此处下载最新版本并手动安装https://github.com/gohugoio/hugo/releases。 - Mark B
“upgrade” 命令只是 “sudo apt-get upgrade hugo” 吗?你是不是建议我去仓库并克隆它?我该如何使用它来升级我已安装的 Hugo 版本? - sgmm
是的,我使用 apt 安装了它,并尝试了 upgrade,但没有成功。我还下载了 tar 文件并解压缩了它,但不知道如何安装新版本的 Hugo。里面有一个名为 hugo 的文件,但我不知道如何使用它。 - sgmm
显示剩余4条评论
2个回答

11

Ubuntu的主要下载库由Canonical维护,但是它们对于GoHugo的最新版本已经过时。 因此,sudo apt upgrade hugo并不会有太大帮助。即使现在,hugo的最新版本是8月份的0.48版,但apt也只提供了截至4月份的0.40版本。

在Ubuntu中始终尝试使用sudo snap install hugo以获得更新的Go Hugo体验。Snaps得到很好的维护和更新。因此,即使您错过手动更新软件包,它也会在12小时内平稳后台更新,直到到达Snap Store。

如果可能,请卸载所有Hugo实例,并尝试使用snaps进行全新安装,因为新版本总是倾向于放弃一些旧配置的支持。您可以尝试使用sudo snap search hugo验证所需的hugo版本,该命令给出了目前在snap store中可用的最新版本的详细信息。

或者手动从链接下载最新版本,并使用sudo hugo version检查您的版本。 您还可以通过whereis hugo确认其在系统中的主要位置,并将其替换为更新版本。


3
如果你使用apt无法获取最新版本的Hugo,则应尝试直接从Github存储库下载。单击最新版本(或您需要的任何版本)。进入发布页面后,向下滚动到“下载”部分,然后通过单击文件或使用wget下载压缩文件来下载文件。然后解压文件并运行./hugo version以确认版本。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接