Dear people of Netlify, hi!
First post after three years almost solving with the forum but this time I cannot deal with the error by myself alone.
I upgraded the hugo version from 0.74.3 to 0.101.0 because I was reporting an error with .Crop function whereas in my localhost with 0.101.0 everything was smooth.
From now on, the following error:
8:44:42 PM: build-image version: 5b0ab77c5e46895703390c45e86a907d4b78547b (focal)
8:44:42 PM: buildbot version: 5b0ab77c5e46895703390c45e86a907d4b78547b
8:44:42 PM: Fetching cached dependencies
8:44:42 PM: Starting to download cache of 2.3GB
8:44:59 PM: Finished downloading cache in 16.729s
8:44:59 PM: Starting to extract cache
8:45:02 PM: Finished extracting cache in 2.578s
8:45:02 PM: Finished fetching cache in 19.49s
8:45:02 PM: Starting to prepare the repo for build
8:45:02 PM: Preparing Git Reference refs/heads/master
8:45:08 PM: Parsing package.json dependencies
8:45:09 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus '/' in the Netlify UI
8:45:09 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo --gc --minify' versus 'hugo' in the Netlify UI
8:45:09 PM: Starting build script
8:45:09 PM: Installing dependencies
8:45:09 PM: Python version set to 2.7
8:45:09 PM: Started restoring cached Node.js version
8:45:10 PM: Finished restoring cached Node.js version
8:45:10 PM: v10.24.1 is already installed.
8:45:11 PM: Now using node v10.24.1 (npm v6.14.12)
8:45:11 PM: Started restoring cached build plugins
8:45:11 PM: Finished restoring cached build plugins
8:45:11 PM: Attempting Ruby version 2.6.2, read from environment
8:45:11 PM: Started restoring cached Ruby version
8:45:11 PM: Finished restoring cached Ruby version
8:45:11 PM: Using Ruby version 2.6.2
8:45:11 PM: Using PHP version 8.0
8:45:11 PM: Installing Hugo 0.101.0
8:45:12 PM: hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio
8:45:12 PM: Started restoring cached go cache
8:45:12 PM: Finished restoring cached go cache
8:45:12 PM: Installing Go version 1.12 (requested 1.12)
8:45:17 PM: go version go1.12 linux/amd64
8:45:17 PM: Detected 2 framework(s)
8:45:17 PM: "hugo" at version "unknown"
8:45:17 PM: "zola" at version "unknown"
8:45:17 PM: Installing missing commands
8:45:17 PM: Verify run directory
8:45:17 PM: Section completed: initializing
8:45:19 PM: β
8:45:19 PM: Netlify Build
8:45:19 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
8:45:19 PM: β
8:45:19 PM: β― Version
8:45:19 PM: @netlify/build 29.5.7
8:45:19 PM: β
8:45:19 PM: β― Flags
8:45:19 PM: baseRelDir: true
8:45:19 PM: buildId: 63f12aa8bd999000082009ff
8:45:19 PM: deployId: 63f12aa8bd99900008200a01
8:45:19 PM: β
8:45:19 PM: β― Current directory
8:45:19 PM: /opt/build/repo
8:45:19 PM: β
8:45:19 PM: β― Config file
8:45:19 PM: /opt/build/repo/netlify.toml
8:45:19 PM: β
8:45:19 PM: β― Context
8:45:19 PM: production
8:45:19 PM: β
8:45:19 PM: β― Installing plugins
8:45:19 PM: - @netlify/plugin-lighthouse@4.0.7
8:45:30 PM: β
8:45:30 PM: β― Loading plugins
8:45:30 PM: - @netlify/plugin-lighthouse@4.0.7 from Netlify app
8:45:32 PM: β
8:45:32 PM: 1. build.command from netlify.toml
8:45:32 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
8:45:32 PM: β
8:45:32 PM: $ hugo --gc --minify
8:45:32 PM: Total in 0 ms
8:45:32 PM: panic: publishDir is empty
8:45:32 PM: goroutine 1 [running]:
8:45:32 PM: github.com/gohugoio/hugo/hugofs.newFs({0x27c48c0, 0x3847860}, {0x27c48c0?, 0x3847860}, {0x27c4e50, 0xc00051cc80})
8:45:32 PM: /root/project/hugo/hugofs/fs.go:96 +0x505
8:45:32 PM: github.com/gohugoio/hugo/hugofs.NewFromSourceAndDestination(...)
8:45:32 PM: /root/project/hugo/hugofs/fs.go:89
8:45:32 PM: github.com/gohugoio/hugo/commands.(*commandeer).loadConfig.func3()
8:45:32 PM: /root/project/hugo/commands/commandeer.go:424 +0x88
8:45:32 PM: sync.(*Once).doSlow(0x27c4e50?, 0x216e301?)
8:45:32 PM: /usr/local/go/src/sync/once.go:68 +0xc2
8:45:32 PM: sync.(*Once).Do(...)
8:45:32 PM: /usr/local/go/src/sync/once.go:59
8:45:32 PM: github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc0002fd770)
8:45:32 PM: /root/project/hugo/commands/commandeer.go:422 +0xa19
8:45:33 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:45:32 PM: github.com/gohugoio/hugo/commands.newCommandeer(0x1, 0x1, 0x0, 0xc0002fd680, {0x27adee0?, 0xc00051f1e0}, 0xc00051f390, {0x0, 0x0, 0x0})
8:45:32 PM: /root/project/hugo/commands/commandeer.go:226 +0x310
8:45:32 PM: github.com/gohugoio/hugo/commands.initializeConfig(0x0?, 0xfd?, 0xb3?, 0xc000b3fca0?, {0x27adee0?, 0xc00051f1e0?}, 0x2f?)
8:45:32 PM: /root/project/hugo/commands/hugo.go:125 +0x3b
8:45:32 PM: github.com/gohugoio/hugo/commands.(*commandsBuilder).newHugoCmd.func1(0xc0008c2f00, {0x2120a8d?, 0x2?, 0x2?})
8:45:32 PM: /root/project/hugo/commands/commands.go:165 +0x135
8:45:32 PM: github.com/spf13/cobra.(*Command).execute(0xc0008c2f00, {0xc00011c070, 0x2, 0x2})
8:45:32 PM: /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x67c
8:45:32 PM: github.com/spf13/cobra.(*Command).ExecuteC(0xc0008c2f00)
8:45:32 PM: /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
8:45:32 PM: github.com/gohugoio/hugo/commands.Execute({0xc00011c070, 0x2, 0x2})
8:45:32 PM: /root/project/hugo/commands/hugo.go:92 +0xb4
8:45:32 PM: main.main()
8:45:32 PM: /root/project/hugo/main.go:23 +0x57
8:45:32 PM: β
8:45:32 PM: "build.command" failed
8:45:32 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
8:45:32 PM: β
8:45:32 PM: Error message
8:45:32 PM: Command failed with exit code 2: hugo --gc --minify (https://ntl.fyi/exit-code-2)
8:45:32 PM: β
8:45:32 PM: Error location
8:45:32 PM: In build.command from netlify.toml:
8:45:32 PM: hugo --gc --minify
8:45:32 PM: β
8:45:32 PM: Resolved config
8:45:32 PM: build:
8:45:32 PM: command: hugo --gc --minify
8:45:32 PM: commandOrigin: config
8:45:32 PM: environment:
8:45:32 PM: - HUGO_VERSION
8:45:32 PM: - HUGO_ENV
8:45:32 PM: - HUGO_ENABLEGITINFO
8:45:32 PM: - HUGO_THEME
8:45:32 PM: publish: /opt/build/repo/public
8:45:32 PM: publishOrigin: config
8:45:32 PM: plugins:
8:45:32 PM: - inputs: {}
8:45:32 PM: origin: ui
8:45:32 PM: package: '@netlify/plugin-lighthouse'
8:45:32 PM: Caching artifacts
8:45:32 PM: Started saving build plugins
8:45:32 PM: Finished saving build plugins
8:45:32 PM: Started saving pip cache
8:45:32 PM: Finished saving pip cache
8:45:32 PM: Started saving emacs cask dependencies
8:45:33 PM: Finished saving emacs cask dependencies
8:45:33 PM: Started saving maven dependencies
8:45:33 PM: Finished saving maven dependencies
8:45:33 PM: Started saving boot dependencies
8:45:33 PM: Finished saving boot dependencies
8:45:33 PM: Started saving rust rustup cache
8:45:33 PM: Finished saving rust rustup cache
8:45:33 PM: Started saving go dependencies
8:45:33 PM: Finished saving go dependencies
8:45:33 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:45:33 PM: Failing build: Failed to build site
8:45:33 PM: Finished processing build request in 50.637s
My netlify.toml:
[build]
command = "hugo --gc --minify"
publish = "public"
[context.production.environment]
HUGO_VERSION = "0.101.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
Any help, please?