Academic theme: Netlify deployment problems

I have been trying to deploy a website created as a new project in RStudio, I’m using the Academic-theme. Trying to deploy from Gitlab to Netlify, I have encountered an error that hasn’t allowed me to deploy my build. Have read many forums about this common “build returned non-zero exit code: 255” error, but none of the suggestions seems to work:

Here’s the link of my last failed deploy:
https://app.netlify.com/sites/eager-jang-c76b35/deploys/5dea73092ed1f60009982461

This is a link of my tries and discussion on the topic so far so far:

In advance thank you very much for your attention.

The log isn’t accessible.

You are right. I don’t know how to make it public though, but this is the log:

10:26:01 AM: Build ready to start
10:26:03 AM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
10:26:03 AM: build-image tag: v3.3.5
10:26:03 AM: buildbot version: 94178e8d3e0dd79630813c690b9aae771c4d9605
10:26:03 AM: Fetching cached dependencies
10:26:03 AM: Failed to fetch cache, continuing with build
10:26:03 AM: Starting to prepare the repo for build
10:26:05 AM: No cached dependencies found. Cloning fresh repo
10:26:05 AM: git clone git@gitlab.com:sittoche/krotanote
10:26:06 AM: Preparing Git Reference refs/heads/master
10:26:07 AM: Starting build script
10:26:07 AM: Installing dependencies
10:26:09 AM: v10.17.0 is already installed.
10:26:09 AM: Now using node v10.17.0 (npm v6.11.3)
10:26:10 AM: Attempting ruby version 2.6.2, read from environment
10:26:11 AM: Using ruby version 2.6.2
10:26:12 AM: Using PHP version 5.6
10:26:12 AM: Started restoring cached go cache
10:26:12 AM: Finished restoring cached go cache
10:26:12 AM: unset GOOS;
10:26:12 AM: unset GOARCH;
10:26:12 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
10:26:12 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
10:26:12 AM: go version >&2;
10:26:12 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
10:26:12 AM: go version go1.12 linux/amd64
10:26:12 AM: Installing missing commands
10:26:12 AM: Verify run directory
10:26:12 AM: Executing user command: hugo --gc --minify -b $URL
10:26:12 AM: Error: "/opt/build/repo/themes/hugo-academic/layouts/partials/functions/get_address.html:21:1": parse failed: template: partials/functions/get_address.html:21: function "return" not defined
10:26:12 AM: Skipping functions preparation step: no functions directory set
10:26:12 AM: Caching artifacts
10:26:12 AM: Started saving pip cache
10:26:12 AM: Finished saving pip cache
10:26:12 AM: Started saving emacs cask dependencies
10:26:12 AM: Finished saving emacs cask dependencies
10:26:12 AM: Started saving maven dependencies
10:26:12 AM: Finished saving maven dependencies
10:26:12 AM: Started saving boot dependencies
10:26:12 AM: Finished saving boot dependencies
10:26:12 AM: Started saving go dependencies
10:26:12 AM: Finished saving go dependencies
10:26:14 AM: Error running command: Build script returned non-zero exit code: 255
10:26:14 AM: Failing build: Failed to build site
10:26:14 AM: failed during stage 'building site': Build script returned non-zero exit code: 255
10:26:14 AM: Finished processing build request in 11.004936344s

Well there is a specific ERROR message in the deploy log you posted.

Error: “/opt/build/repo/themes/hugo-academic/layouts/partials/functions/get_address.html:21:1”: parse failed: template: partials/functions/get_address.html:21: function “return” not defined

The Academic Theme requires Hugo 0.58.0 as a minimum.
Have you defined the Hugo version that is used in the Netlify Build?
I do not see a netlify.toml in your repo.
Have you set up the Hugo version in the Netlify admin panel?

It seems that the build fails because it uses the default Hugo version installed in the Netlify build image i.e. Hugo 0.54 extended (according to the deploy log).

1 Like

Hi.
There’s a netlify.toml but the creator of the theme placed it in the path: themes > hugo-academic > netlify.toml.

I currently have the hugo version for netlify of:
hugo --gc --minify -b $URL

I have tried writing the hugo command build as:
HUGO_VERSION
hugo
hugo_0.60.1

But none seems to work correctly.
The netlify.toml has as content:

[build]

publish = "public"

command = "hugo --gc --minify"

[context.production.environment]

HUGO_VERSION = "0.60.1"

HUGO_ENV = "production"

HUGO_ENABLEGITINFO = "true"

[context.split1]

command = "hugo --gc --minify --enableGitInfo"

[context.split1.environment]

HUGO_VERSION = "0.60.1"

HUGO_ENV = "production"

[context.deploy-preview]

command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]

HUGO_VERSION = "0.60.1"

[context.branch-deploy]

command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]

HUGO_VERSION = "0.60.1"

[context.next.environment]

HUGO_ENABLEGITINFO = "true"

Normally on other queries everyone has two blanks for the build command, so normally I see e.g. “HUGO_VERSION 0.58.0” in two sections so I’m not quite sure if the version I’m establishing is actually working:

Typically the netlify.toml resides under the root of the project that is going to be deployed.

It doesn’t seem like it is inherited from the root of the themes/academic directory -as you describe-.

Also note that your question may get a better answer at the Netlify forum or the Academic chat, since this is related to the deployment of that particular theme.

Or ask the author of Academic to provide better documentation regarding the deployment of the Academic theme on Netlify.