I have a Hugo site (using version 0.63.2) hosted on Netlify. The site has been live for several months now with many deploys from both a master branch and staging branch and have never had a deploy fail.
I have a feature branch (feature-blog) that I am trying to push to Netlify. This feature branch adds a blog to the site (posts, category taxonomy, and Netlify cms). The Hugo version has not changed and the site builds with no issues on my local machine. Everything I have read with similar issues is solved by specifying the Hugo version in the Netlify config file, but I already have that in place and still getting failed deploys.
This is my local Hugo version: Hugo Static Site Generator v0.63.2/extended darwin/amd64
In Netlify Build Image Selection, I have Ubuntu Xenial 16.04 (default) selected
Here are the contents of my netlify.toml file:
[context.production.environment]
HUGO_VERSION = "0.63.2"
[context.deploy-preview.environment]
HUGO_VERSION = "0.63.2"
[context.branch-deploy]
HUGO_VERSION = "0.63.2"
command = "npm i && npm run gulp && hugo --environment=staging"
[context."feature-blog"]
HUGO_VERSION = "0.63.2"
command = "npm i && npm run gulp && hugo --environment=feature-blog"
I have a Hugo config file at /config/feature-blog/config.toml. The only thing in this file is
baseURL = “https://feature-blog--uprightpr.netlify.app/”
Here is the deploy log:
9:36:48 PM: Build ready to start
9:36:51 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
9:36:51 PM: build-image tag: v3.6.0
9:36:51 PM: buildbot version: 7d7f8cd4cc19a5205bae0ea8df58feec103fed05
9:36:51 PM: Fetching cached dependencies
9:36:51 PM: Starting to download cache of 153.3MB
9:36:52 PM: Finished downloading cache in 1.216640617s
9:36:52 PM: Starting to extract cache
9:36:56 PM: Finished extracting cache in 3.581356387s
9:36:56 PM: Finished fetching cache in 4.884100904s
9:36:56 PM: Starting to prepare the repo for build
9:36:56 PM: Preparing Git Reference refs/heads/feature-blog
9:37:01 PM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘npm i && npm run gulp && hugo --environment=feature-blog’ versus ‘npm i && npm run gulp && hugo --gc’ in the Netlify UI
9:37:02 PM: Starting build script
9:37:02 PM: Installing dependencies
9:37:02 PM: Python version set to 2.7
9:37:02 PM: Started restoring cached node version
9:37:04 PM: Finished restoring cached node version
9:37:05 PM: v12.18.0 is already installed.
9:37:05 PM: Now using node v12.18.0 (npm v6.14.4)
9:37:06 PM: Started restoring cached build plugins
9:37:06 PM: Finished restoring cached build plugins
9:37:06 PM: Attempting ruby version 2.7.1, read from environment
9:37:07 PM: Using ruby version 2.7.1
9:37:07 PM: Using PHP version 5.6
9:37:07 PM: Started restoring cached node modules
9:37:07 PM: Finished restoring cached node modules
9:37:08 PM: Started restoring cached go cache
9:37:08 PM: Finished restoring cached go cache
9:37:08 PM: go version go1.14.4 linux/amd64
9:37:08 PM: go version go1.14.4 linux/amd64
9:37:08 PM: Installing missing commands
9:37:08 PM: Verify run directory
9:37:09 PM:
9:37:09 PM: ────────────────────────────────────────────────────────────────
9:37:09 PM: Netlify Build
9:37:09 PM: ────────────────────────────────────────────────────────────────
9:37:09 PM:
9:37:09 PM: ❯ Version
9:37:09 PM: @netlify/build 8.0.5
9:37:09 PM:
9:37:09 PM: ❯ Flags
9:37:09 PM: deployId: 600251406faa7e0007dc489a
9:37:09 PM: mode: buildbot
9:37:09 PM:
9:37:09 PM: ❯ Current directory
9:37:09 PM: /opt/build/repo
9:37:09 PM:
9:37:09 PM: ❯ Config file
9:37:09 PM: /opt/build/repo/netlify.toml
9:37:09 PM:
9:37:09 PM: ❯ Context
9:37:09 PM: branch-deploy
9:37:09 PM:
9:37:09 PM: ────────────────────────────────────────────────────────────────
9:37:09 PM: 1. build.command from netlify.toml
9:37:09 PM: ────────────────────────────────────────────────────────────────
9:37:09 PM:
9:37:09 PM: $ npm i && npm run gulp && hugo --environment=feature-blog
9:37:13 PM: npm WARN upright@0.0.1 No repository field.
9:37:13 PM: npm WARN upright@0.0.1 No license field.
9:37:13 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
9:37:13 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
9:37:13 PM: audited 512 packages in 2.778s
9:37:13 PM: 20 packages are looking for funding
9:37:13 PM: run npm fund
for details
9:37:13 PM: found 2 low severity vulnerabilities
9:37:13 PM: run npm audit fix
to fix them, or npm audit
for details
9:37:13 PM: > upright@0.0.1 gulp /opt/build/repo
9:37:13 PM: > gulp
9:37:14 PM: [02:37:14] Using gulpfile /opt/build/repo/gulpfile.js
9:37:14 PM: [02:37:14] Starting ‘default’…
9:37:14 PM: [02:37:14] Starting ‘sass’…
9:37:15 PM: [02:37:15] Finished ‘sass’ after 1.24 s
9:37:15 PM: [02:37:15] Finished ‘default’ after 1.24 s
9:38:55 PM: Building sites … ERROR 2021/01/16 02:38:55 render of “taxonomy” failed: “/opt/build/repo/layouts/category/taxonomy.html:16:77”: execute of template failed: template: category/taxonomy.html:16:77: executing “main” at <.Page.Permalink>: can’t evaluate field Page in type hugolib.WeightedPagesERROR 2021/01/16 02:38:55 render of “section” failed: “/opt/build/repo/layouts/insights/list.html:15:55”: execute of template failed: template: insights/list.html:15:55: executing “main” at <.Page.Permalink>: can’t evaluate field Page in type hugolib.WeightedPagesERROR 2021/01/16 02:38:55 render of “taxonomy” failed: “/opt/build/repo/layouts/category/taxonomy.html:16:77”: execute of template failed: template: category/taxonomy.html:16:77: executing “main” at <.Page.Permalink>: can’t evaluate field Page in type hugolib.WeightedPagesERROR 2021/01/16 02:38:55 render of “taxonomy” failed: “/opt/build/repo/layouts/category/taxonomy.html:16:77”: execute of template failed: template: category/taxonomy.html:16:77: executing “main” at <.Page.Permalink>: can’t evaluate field Page in type hugolib.WeightedPagesTotal in 99804 ms
9:38:55 PM: Error: Error building site: failed to render pages: render of “taxonomy” failed: “/opt/build/repo/layouts/category/taxonomy.html:16:77”: execute of template failed: template: category/taxonomy.html:16:77: executing “main” at <.Page.Permalink>: can’t evaluate field Page in type hugolib.WeightedPages
9:38:55 PM: ────────────────────────────────────────────────────────────────
9:38:55 PM: “build.command” failed
9:38:55 PM: ────────────────────────────────────────────────────────────────
9:38:55 PM:
9:38:55 PM: Error message
9:38:55 PM: Command failed with exit code 255: npm i && npm run gulp && hugo --environment=feature-blog
9:38:55 PM:
9:38:55 PM: Error location
9:38:55 PM: In build.command from netlify.toml:
9:38:55 PM: npm i && npm run gulp && hugo --environment=feature-blog
9:38:55 PM:
9:38:55 PM: Resolved config
9:38:55 PM: build:
9:38:55 PM: command: npm i && npm run gulp && hugo --environment=feature-blog
9:38:55 PM: commandOrigin: config
9:38:55 PM: publish: /opt/build/repo/public
9:38:56 PM: Caching artifacts
9:38:56 PM: Started saving node modules
9:38:56 PM: Finished saving node modules
9:38:56 PM: Started saving build plugins
9:38:56 PM: Finished saving build plugins
9:38:56 PM: Started saving pip cache
9:38:56 PM: Finished saving pip cache
9:38:56 PM: Started saving emacs cask dependencies
9:38:56 PM: Finished saving emacs cask dependencies
9:38:56 PM: Started saving maven dependencies
9:38:56 PM: Finished saving maven dependencies
9:38:56 PM: Started saving boot dependencies
9:38:56 PM: Finished saving boot dependencies
9:38:56 PM: Started saving rust rustup cache
9:38:56 PM: Finished saving rust rustup cache
9:38:56 PM: Started saving rust cargo bin cache
9:38:56 PM: Finished saving rust cargo bin cache
9:38:56 PM: Started saving go dependencies
9:38:56 PM: Finished saving go dependencies
9:38:56 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:38:56 PM: Failing build: Failed to build site
9:38:56 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
9:38:56 PM: Finished processing build request in 2m5.276881582s
Any suggestions to help solve this are greatly appreciated.