Oleksandr Husiev
Oleksandr Husiev

Reputation: 152

No hugo command found while deploying on AWS

I am trying to deploy my hugo project with a theme different than ananke as a submodule on AWS Amplify. But on while building my site on AWS I get next error(tried with terrassa and mero themes):

2019-06-22T23:28:55.910Z [WARNING]: Error: "/codebuild/output/src464253642/src/hugo-sandbox/themes/terrassa/layouts/partials/head.html:10:1": parse failed: template: partials/head.html:10: function "hugo" not defined

Locally server runs fine. gitmodules include the themes/terrassa. My build command is simple hugo. What can be wrong?

Upvotes: 1

Views: 322

Answers (1)

zwbetz
zwbetz

Reputation: 1100

It's likely that your theme is using the global hugo keyword to access hugo-specific variables. This keyword is only available in hugo version 0.53 and above. So make sure your AWS Amplify setup is using at least that hugo version -- I would recommend using the latest version, which is 0.56.0 as of 2019-06-24.

Update: To specify your hugo version in AWS Amplify, use build commands such as below. 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: []

Upvotes: 2

Related Questions