# Academic theme: Netlify deployment problems

**URL:** https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186
**Category:** Using Themes
**Created:** [December 6, 2019, 3:59pm UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186 "2019-12-06T15:59:30Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Stradichenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/stradichenko/32/19735_2.png) [@Stradichenko](https://discourse.gohugo.io/u/Stradichenko)
#### Post date: [December 6, 2019, 3:59pm UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/1 "2019-12-06T15:59:31Z")

</div>

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](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:

> <https://github.com/gcushen/hugo-academic/issues/1453>
>
> I created a blogwdown project yesterday using RStudio. I created the theme repo in GitLab and today I tried to Deploy...

In advance thank you very much for your attention.

---

<div class="post-metadata">

### Author: ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)
#### Post date: [December 6, 2019, 6:35pm UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/2 "2019-12-06T18:35:31Z")

</div>

The log isn’t accessible.

---

<div class="post-metadata">

### Author: ![Stradichenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/stradichenko/32/19735_2.png) [@Stradichenko](https://discourse.gohugo.io/u/Stradichenko)
#### Post date: [December 6, 2019, 7:58pm UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/3 "2019-12-06T19:58:56Z")

</div>

> [@Stradichenko](#):
>
> [Netlify App](https://app.netlify.com/sites/eager-jang-c76b35/deploys/5dea73092ed1f60009982461)

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

```auto
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

```

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [December 6, 2019, 8:29pm UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/4 "2019-12-06T20:29:01Z")

</div>

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

```auto
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).

---

<div class="post-metadata">

### Author: ![Stradichenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/stradichenko/32/19735_2.png) [@Stradichenko](https://discourse.gohugo.io/u/Stradichenko)
#### Post date: [December 7, 2019, 1:11am UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/5 "2019-12-07T01:11:19Z")

</div>

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:

```auto
[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"

```

---

<div class="post-metadata">

### Author: ![Stradichenko](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/stradichenko/32/19735_2.png) [@Stradichenko](https://discourse.gohugo.io/u/Stradichenko)
#### Post date: [December 7, 2019, 1:31am UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/6 "2019-12-07T01:31:08Z")

</div>

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:

 ![2019-12-06 20_27_36-Window](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/7/70bed0e11af87df3682239441987b10c60b9ea63.png)

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [December 7, 2019, 9:15am UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/7 "2019-12-07T09:15:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [December 7, 2019, 9:17am UTC](https://discourse.gohugo.io/t/academic-theme-netlify-deployment-problems/22186/8 "2019-12-07T09:17:07Z")

</div>


