Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netlify - Error: GetFeaturedImage.html:35:1: parse failed: template: GetFeaturedImage.html:35: function return not defined #306

Closed
melvinsalas opened this issue Jun 25, 2020 · 6 comments
Assignees
Labels

Comments

@melvinsalas
Copy link
Contributor

The Netlify deploy don't work with the last version of the theme since 2 days ago

CleanShot 2020-06-25 at 09 07 45@2x

This is the error

CleanShot 2020-06-25 at 09 08 17@2x

And this is the log

8:53:40 AM: Build ready to start
8:53:42 AM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
8:53:42 AM: build-image tag: v3.3.17
8:53:42 AM: buildbot version: 1f35b3abd6e2bf5230d8edf68072840fdec1513f
8:53:42 AM: Fetching cached dependencies
8:53:42 AM: Starting to download cache of 254.3KB
8:53:42 AM: Finished downloading cache in 66.956662ms
8:53:42 AM: Starting to extract cache
8:53:42 AM: Failed to fetch cache, continuing with build
8:53:42 AM: Starting to prepare the repo for build
8:53:43 AM: No cached dependencies found. Cloning fresh repo
8:53:43 AM: git clone https://github.com/melvinsalas/tucurrique.go.cr
8:53:44 AM: Preparing Git Reference refs/heads/master
8:53:47 AM: Starting build script
8:53:47 AM: Installing dependencies
8:53:47 AM: Python version set to 2.7
8:53:48 AM: Downloading and installing node v10.21.0...
8:53:48 AM: Downloading https://nodejs.org/dist/v10.21.0/node-v10.21.0-linux-x64.tar.xz...
8:53:48 AM: Computing checksum with sha256sum
8:53:48 AM: Checksums matched!
8:53:50 AM: Now using node v10.21.0 (npm v6.14.4)
8:53:51 AM: Started restoring cached build plugins
8:53:51 AM: Finished restoring cached build plugins
8:53:51 AM: Attempting ruby version 2.6.2, read from environment
8:53:52 AM: Using ruby version 2.6.2
8:53:52 AM: Using PHP version 5.6
8:53:52 AM: 5.2 is already installed.
8:53:52 AM: Using Swift version 5.2
8:53:52 AM: Started restoring cached go cache
8:53:52 AM: Finished restoring cached go cache
8:53:52 AM: Installing Go version 1.12
8:53:58 AM: unset GOOS;
8:53:58 AM: unset GOARCH;
8:53:58 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
8:53:58 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
8:53:58 AM: go version >&2;
8:53:58 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
8:53:58 AM: go version go1.12 linux/amd64
8:53:58 AM: Installing missing commands
8:53:58 AM: Verify run directory
8:53:59 AM: ​
8:53:59 AM: ┌─────────────────────────────┐
8:53:59 AM: │        Netlify Build        │
8:53:59 AM: └─────────────────────────────┘
8:53:59 AM: ​
8:53:59 AM: ❯ Version
8:53:59 AM:   @netlify/build 2.0.10
8:53:59 AM: ​
8:53:59 AM: ❯ Flags
8:53:59 AM:   deployId: 5ef4ba74b1ded7878d6b57cc
8:53:59 AM:   mode: buildbot
8:53:59 AM: ​
8:53:59 AM: ❯ Current directory
8:53:59 AM:   /opt/build/repo
8:53:59 AM: ​
8:53:59 AM: ❯ Config file
8:53:59 AM:   No config file was defined: using default values.
8:53:59 AM: ​
8:53:59 AM: ❯ Context
8:53:59 AM:   production
8:53:59 AM: ​
8:53:59 AM: ❯ Loading plugins
8:53:59 AM:    - netlify-plugin-image-optim@0.3.0 from Netlify app
8:54:01 AM: ​
8:54:01 AM: ┌────────────────────────────────┐
8:54:01 AM: │ 1. Build command from settings │
8:54:01 AM: └────────────────────────────────┘
8:54:01 AM: ​
8:54:01 AM: $ hugo
8:54:01 AM: Error: "/opt/build/repo/themes/ananke/layouts/partials/func/GetFeaturedImage.html:35:1": parse failed: template: partials/func/GetFeaturedImage.html:35: function "return" not defined
8:54:01 AM: ​
8:54:01 AM: ┌─────────────────────────────┐
8:54:01 AM: │   "build.command" failed    │
8:54:01 AM: └─────────────────────────────┘
8:54:01 AM: ​
8:54:01 AM:   Error message
8:54:01 AM:   Command failed with exit code 255: hugo
8:54:01 AM: ​
8:54:01 AM:   Error location
8:54:01 AM:   In Build command from settings:
8:54:01 AM:   hugo
8:54:01 AM: ​
8:54:01 AM:   Resolved config
8:54:01 AM:   build:
8:54:01 AM:     command: hugo
8:54:01 AM:     publish: /opt/build/repo/public
8:54:01 AM:   plugins:
8:54:01 AM:     - inputs: {}
8:54:01 AM:       origin: ui
8:54:01 AM:       package: netlify-plugin-image-optim
8:54:01 AM: Caching artifacts
8:54:01 AM: Started saving build plugins
8:54:01 AM: Finished saving build plugins
8:54:01 AM: Started saving pip cache
8:54:07 AM: Finished saving pip cache
8:54:07 AM: Started saving emacs cask dependencies
8:54:07 AM: Finished saving emacs cask dependencies
8:54:07 AM: Started saving maven dependencies
8:54:07 AM: Finished saving maven dependencies
8:54:07 AM: Started saving boot dependencies
8:54:07 AM: Finished saving boot dependencies
8:54:07 AM: Started saving go dependencies
8:54:09 AM: Finished saving go dependencies
8:54:12 AM: Error running command: Build script returned non-zero exit code: 1
8:54:12 AM: Failing build: Failed to build site
8:54:12 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
8:54:12 AM: Finished processing build request in 30.279996959s
@regisphilibert
Copy link
Member

Hello, yes we recently introduced a new returning partial. the return statement was introduced in Hugo 0.55.0, if you upgrade your version this should fix it for you.

In the mean time we'll bumb the min version of the theme to .55.

Thanks for reporting this.

@melvinsalas
Copy link
Contributor Author

melvinsalas commented Jun 25, 2020

Thanks!

I added the environment variable to HUGO_VERSION and the problem was gone.

CleanShot 2020-06-25 at 09 39 56@2x

CleanShot 2020-06-25 at 09 41 20@2x

regisphilibert added a commit that referenced this issue Jun 25, 2020
@meerasndr
Copy link

I'm facing this exact same problem. Tried @melvinsalas 's workaround, but that gave me this error:

Error during Hugo 0.73 install: error downloading project gohugoio/hugo, from https://github.com/gohugoio/hugo/releases/download/v0.73/hugo_extended_0.73_Linux-64bit.tar.gz - binary doesn't seem to exist: 404

Any pointers?

@melvinsalas
Copy link
Contributor Author

@meerasndr
Copy link

@melvinsalas I changed the env variable to 0.74.0. That worked. Thanks for the help.

@homerhanumat
Copy link

Don't know if this is the best place to post this observation, but here goes:

For deploy previews (as opposed to production deploys) Netlify may be using an older version of Hugo. At any rate I found that all of my deploy previews were failing precisely for the reason cited in this Issue, but taking a hint from the comments above I fixed the problem by adding the following to my netlify.toml:

[context.deploy-preview.environment]
  HUGO_VERSION = "0.73.0"

Remicck pushed a commit to Remicck/gohugo-theme-ananke that referenced this issue Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants