I have the same issue.
I even tried to delete cache before the build command:
[build]
publish = "public"
command = "rm -rf /opt/build/cache && hugo --gc --minify"
Sadly didn’t solve anything.
Deployment is still stuck and can’t go ahead unless you manually stop and click Clear Cache and deploy site
I would also like to point out that there are issues with Hugo versions as well:
10:14:43 AM: Build ready to start
10:14:46 AM: build-image version: a6bb34428a07e7de82f4df5dfe1843fbde91f670 (focal)
10:14:46 AM: build-image tag: v4.5.1
10:14:46 AM: buildbot version: 5284b4d1b8b4cf691b29019968d8e4eb3089acdd
10:14:47 AM: Fetching cached dependencies
10:14:47 AM: Starting to download cache of 111.2MB
10:14:48 AM: Finished downloading cache in 1.356565392s
10:14:48 AM: Starting to extract cache
10:14:51 AM: Finished extracting cache in 3.386578635s
10:14:51 AM: Finished fetching cache in 4.779807493s
10:14:51 AM: Starting to prepare the repo for build
10:14:52 AM: Preparing Git Reference refs/heads/master
10:14:53 AM: Parsing package.json dependencies
10:14:53 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'rm -rf /opt/build/cache && hugo --gc --minify' versus 'hugo' in the Netlify UI
10:14:54 AM: Starting build script
10:14:54 AM: Installing dependencies
10:14:54 AM: Python version set to 2.7
10:14:54 AM: Started restoring cached node version
10:14:57 AM: Finished restoring cached node version
10:14:57 AM: v16.13.1 is already installed.
10:14:58 AM: Now using node v16.13.1 (npm v8.1.2)
10:14:58 AM: Started restoring cached build plugins
10:14:58 AM: Finished restoring cached build plugins
10:14:58 AM: Attempting ruby version 2.7.2, read from environment
10:15:01 AM: Using ruby version 2.7.2
10:15:01 AM: Using PHP version 8.0
10:15:01 AM: Installing Hugo 0.89.4
10:15:03 AM: hugo v0.89.4-AB01BA6E+extended linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio
10:15:03 AM: Started restoring cached go cache
10:15:03 AM: Finished restoring cached go cache
10:15:03 AM: go version go1.16.5 linux/amd64
10:15:03 AM: go version go1.16.5 linux/amd64
10:15:03 AM: Installing missing commands
10:15:03 AM: Verify run directory
10:15:05 AM:
10:15:05 AM: ────────────────────────────────────────────────────────────────
10:15:05 AM: Netlify Build
10:15:05 AM: ────────────────────────────────────────────────────────────────
10:15:05 AM:
10:15:05 AM: ❯ Version
10:15:05 AM: @netlify/build 20.3.1
10:15:05 AM:
10:15:05 AM: ❯ Flags
10:15:05 AM: baseRelDir: true
10:15:05 AM: buildId: 61b9b203e059df0008c59a9b
10:15:05 AM: deployId: 61b9b203e059df0008c59a9d
10:15:05 AM:
10:15:05 AM: ❯ Current directory
10:15:05 AM: /opt/build/repo
10:15:05 AM:
10:15:05 AM: ❯ Config file
10:15:05 AM: /opt/build/repo/netlify.toml
10:15:05 AM:
10:15:05 AM: ❯ Context
10:15:05 AM: production
10:15:05 AM:
10:15:05 AM: ❯ Installing plugins
10:15:05 AM: - netlify-plugin-submit-sitemap@0.2.3
10:15:05 AM: - @netlify/plugin-sitemap@0.8.1
10:15:10 AM:
10:15:10 AM: ❯ Loading plugins
10:15:10 AM: - netlify-plugin-submit-sitemap@0.2.3 from netlify.toml
10:15:10 AM: - @netlify/plugin-sitemap@0.8.1 from netlify.toml
10:15:10 AM:
10:15:10 AM: ────────────────────────────────────────────────────────────────
10:15:10 AM: 1. build.command from netlify.toml
10:15:10 AM: ────────────────────────────────────────────────────────────────
10:15:10 AM:
10:15:10 AM: $ rm -rf /opt/build/cache && hugo --gc --minify
10:15:11 AM: Start building sites …
10:15:11 AM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
10:20:22 AM: Canceling deploy
You can see it here:
10:15:01 AM: Installing Hugo 0.89.4
10:15:03 AM: hugo v0.89.4-AB01BA6E+extended linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio
However it then uses a different version to build:
10:15:10 AM: $ rm -rf /opt/build/cache && hugo --gc --minify
10:15:11 AM: Start building sites …
10:15:11 AM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
10:20:22 AM: Canceling deploy
While of course in the netlify.toml
the correct version is specified:
[context.production.environment]
HUGO_VERSION = "0.89.4"
GO_VERSION = "1.17.3"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
I only have two plugins installed:
[[plugins]]
package = "@netlify/plugin-sitemap"
[[plugins]]
package = "netlify-plugin-submit-sitemap"
And I had the very same issue even BEFORE when I had many plugins.
I went over in the last weeks and deleted all of them but these two.
Can you help us? It’s getting very annoying having to go to the pipeline and make sure it didn’t get stuck at some point again.