I had an error while deploying my site with the message “Error: failed to download modules: binary with name “go” not found”.
The previous deployment was successful, and this time, I just replaced an image in the page, which I’m sure shouldn’t affect the deployment.
This problem already happened once yesterday, I had the same error for some time and the deployment failed, I didn’t do anything and after a few hours it deployed successfully again.
I compared it with the previous successful deployment and found the following result in the logs of the correct deployment.
12:53:36 AM: Installing Go version 1.19.4 (requested 1.19.x)
12:53:41 AM: unset GOOS;
12:53:41 AM: unset GOARCH;
12:53:41 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.19.4.linux.amd64';
12:53:41 AM: export PATH="/opt/buildhome/.gimme/versions/go1.19.4.linux.amd64/bin:${PATH}";
12:53:41 AM: go version >&2;
12:53:41 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.19.4.linux.amd64.env"
12:53:41 AM: go version go1.19.4 linux/amd64
And the only result of a failed deployment is the following.
4:27:21 PM: go version go1.19.4 linux/amd64
4:27:21 PM: /opt/build-bin/run-build-functions.sh: line 1034: /opt/buildhome/.gimme/env/go1.19.x.linux.amd64.env: No such file or directory
Here is the deployment log.
4:27:08 PM: build-image version: 524714d1a66d1a967316f5c39465e22c77fdd56c (focal)
4:27:08 PM: build-image tag: v4.16.0
4:27:08 PM: buildbot version: 296df95921b1bce6addc5dc1e3a167221c8c99e9
4:27:09 PM: Fetching cached dependencies
4:27:09 PM: Starting to download cache of 257.1MB
4:27:12 PM: Finished downloading cache in 3.197011067s
4:27:12 PM: Starting to extract cache
4:27:13 PM: Finished extracting cache in 1.262721866s
4:27:13 PM: Finished fetching cache in 4.517930824s
4:27:13 PM: Starting to prepare the repo for build
4:27:13 PM: Preparing Git Reference refs/heads/main
4:27:15 PM: Parsing package.json dependencies
4:27:16 PM: Section completed: initializing
4:27:16 PM: Starting build script
4:27:16 PM: Installing dependencies
4:27:16 PM: Python version set to 2.7
4:27:17 PM: Started restoring cached node version
4:27:17 PM: Finished restoring cached node version
4:27:18 PM: v16.19.0 is already installed.
4:27:18 PM: Now using node v16.19.0 (npm v8.19.3)
4:27:18 PM: Enabling node corepack
4:27:18 PM: Started restoring cached build plugins
4:27:18 PM: Finished restoring cached build plugins
4:27:18 PM: Attempting ruby version 2.7.2, read from environment
4:27:19 PM: Using ruby version 2.7.2
4:27:19 PM: Using PHP version 8.0
4:27:19 PM: Installing Hugo 0.107.0
4:27:20 PM: hugo v0.107.0-2221b5b30a285d01220a26a82305906ad3291880+extended linux/amd64 BuildDate=2022-11-24T13:59:45Z VendorInfo=gohugoio
4:27:20 PM: Started restoring cached go cache
4:27:20 PM: Finished restoring cached go cache
4:27:21 PM: go version go1.19.4 linux/amd64
4:27:21 PM: /opt/build-bin/run-build-functions.sh: line 1034: /opt/buildhome/.gimme/env/go1.19.x.linux.amd64.env: No such file or directory
4:27:21 PM: Detected 0 framework(s)
4:27:21 PM: Installing missing commands
4:27:21 PM: Verify run directory
4:27:23 PM:
4:27:23 PM: ────────────────────────────────────────────────────────────────
4:27:23 PM: Netlify Build
4:27:23 PM: ────────────────────────────────────────────────────────────────
4:27:23 PM:
4:27:23 PM: ❯ Version
4:27:23 PM: @netlify/build 29.0.4
4:27:23 PM:
4:27:23 PM: ❯ Flags
4:27:23 PM: baseRelDir: true
4:27:23 PM: buildId: 639988db74ad241ff934e966
4:27:23 PM: deployId: 639988db74ad241ff934e968
4:27:23 PM:
4:27:23 PM: ❯ Current directory
4:27:23 PM: /opt/build/repo
4:27:23 PM:
4:27:23 PM: ❯ Config file
4:27:23 PM: /opt/build/repo/netlify.toml
4:27:23 PM:
4:27:23 PM: ❯ Context
4:27:23 PM: production
4:27:23 PM:
4:27:23 PM: ❯ Loading plugins
4:27:23 PM: - netlify-plugin-hugo-cache-resources@0.2.1 from netlify.toml
4:27:25 PM:
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM: 1. netlify-plugin-hugo-cache-resources (onPreBuild event)
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM:
4:27:25 PM: Checking if resources exist at "resources"
4:27:25 PM: Restored cached resources folder. Total files: 2
4:27:25 PM: ---
4:27:25 PM: 1. /opt/build/repo/resources
4:27:25 PM: 2. /opt/build/repo/resources/_gen
4:27:25 PM:
4:27:25 PM: (netlify-plugin-hugo-cache-resources onPreBuild completed in 135ms)
4:27:25 PM:
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM: 2. build.command from netlify.toml
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM:
4:27:25 PM: $ hugo --gc --minify -b $URL
4:27:25 PM: Error: failed to download modules: binary with name "go" not found
4:27:25 PM: Total in 0 ms
4:27:25 PM:
4:27:25 PM: Creating deploy upload records
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM: "build.command" failed
4:27:25 PM: ────────────────────────────────────────────────────────────────
4:27:25 PM:
4:27:25 PM: Error message
4:27:26 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:27:25 PM: Command failed with exit code 255: hugo --gc --minify -b $URL (https://ntl.fyi/exit-code-255)
4:27:25 PM:
4:27:25 PM: Error location
4:27:25 PM: In build.command from netlify.toml:
4:27:25 PM: hugo --gc --minify -b $URL
4:27:25 PM:
4:27:25 PM: Resolved config
4:27:25 PM: build:
4:27:25 PM: command: hugo --gc --minify -b $URL
4:27:25 PM: commandOrigin: config
4:27:25 PM: environment:
4:27:25 PM: - NETLIFY_GRAPH_TOKEN
4:27:25 PM: - ONEGRAPH_AUTHLIFY_TOKEN
4:27:25 PM: - HUGO_VERSION
4:27:25 PM: - HUGO_ENABLEGITINFO
4:27:25 PM: - HUGO_ENV
4:27:25 PM: publish: /opt/build/repo/public
4:27:25 PM: publishOrigin: config
4:27:25 PM: plugins:
4:27:25 PM: - inputs:
4:27:25 PM: debug: true
4:27:25 PM: origin: config
4:27:25 PM: package: netlify-plugin-hugo-cache-resources
4:27:25 PM: Caching artifacts
4:27:25 PM: Started saving build plugins
4:27:25 PM: Finished saving build plugins
4:27:25 PM: Started saving pip cache
4:27:25 PM: Finished saving pip cache
4:27:25 PM: Started saving emacs cask dependencies
4:27:25 PM: Finished saving emacs cask dependencies
4:27:25 PM: Started saving maven dependencies
4:27:25 PM: Finished saving maven dependencies
4:27:25 PM: Started saving boot dependencies
4:27:25 PM: Finished saving boot dependencies
4:27:25 PM: Started saving rust rustup cache
4:27:25 PM: Finished saving rust rustup cache
4:27:25 PM: Started saving go dependencies
4:27:25 PM: Finished saving go dependencies
4:27:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:27:25 PM: Failing build: Failed to build site
4:27:26 PM: Finished processing build request in 17.193388227s
``