在 AWS 上部署时找不到 hugo 命令

No hugo command found while deploying on AWS

我正在尝试将主题不同于 ananke 的 hugo 项目部署为 AWS Amplify 上的子模块。但是在 AWS 上构建我的网站时出现下一个错误(尝试使用 terrassa 和 mero 主题):

2019-06-22T23:28:55.910Z [警告]:错误:“/codebuild/output/src464253642/src/hugo-sandbox/themes/terrassa/layouts/partials/head.html:10:1”:解析失败:模板:partials/head。 html:10: 函数 "hugo" 未定义

本地服务器运行良好。 gitmodules 包括 themes/terrassa。我的构建命令很简单 hugo。有什么问题吗?

很可能您的主题使用全局 hugo 关键字访问 hugo 0.53 及更高版本中的 hugo-specific variables. This keyword is only available。因此,请确保您的 AWS Amplify 设置使用 至少 那个 hugo 版本——我建议使用最新版本,截至 2019 年 6 月 24 日为 0.56.0。

更新:要在 AWS Amplify 中指定您的 hugo 版本,请使用如下构建命令。 Source

version: 0.1
frontend:
  phases:
    build:
      commands:
        - wget https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.tar.gz
        - tar -xf hugo_0.55.6_Linux-64bit.tar.gz hugo
        - mv hugo /usr/bin/hugo
        - rm -rf hugo_0.55.6_Linux-64bit.tar.gz
        - hugo
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths: []