Failed during stage 'building site'

Briefly summarize the issues you have been experiencing.

It has been ok until yesterday. Here is the logs:

10:37:00 AM: Build ready to start
10:37:03 AM: build-image version: 8e315e54bc4032a32e73290be556cde4f8348c12
10:37:03 AM: build-image tag: v2.8.2
10:37:03 AM: buildbot version: 1c5d5da2a8a19e94f07a53f82f5c9b010bad1249
10:37:04 AM: Fetching cached dependencies
10:37:04 AM: Starting to download cache of 456.8MB
10:37:08 AM: Finished downloading cache in 4.393499442s
10:37:08 AM: Starting to extract cache
10:37:16 AM: Finished extracting cache in 8.207125038s
10:37:16 AM: Finished fetching cache in 12.733436067s
10:37:16 AM: Starting to prepare the repo for build
10:37:17 AM: Preparing Git Reference refs/heads/gh-pages
10:37:19 AM: Starting build script
10:37:19 AM: Installing dependencies
10:37:20 AM: Started restoring cached node version
10:37:21 AM: Finished restoring cached node version
10:37:22 AM: v8.16.0 is already installed.
10:37:23 AM: Now using node v8.16.0 (npm v6.4.1)
10:37:23 AM: Required ruby-2.4.2 is not installed.
10:37:23 AM: To install do: 'rvm install "ruby-2.4.2"'
10:37:23 AM: Attempting ruby version 2.4.2, read from .ruby-version file
10:37:23 AM: Started restoring cached ruby version
10:37:24 AM: Finished restoring cached ruby version
10:37:25 AM: Using ruby version 2.4.2
10:37:33 AM: Successfully installed bundler-2.0.2
10:37:33 AM: Parsing documentation for bundler-2.0.2
10:37:33 AM: Installing ri documentation for bundler-2.0.2
10:37:33 AM: Done installing documentation for bundler after 6 seconds
10:37:33 AM: 1 gem installed
10:37:33 AM: Using PHP version 5.6
10:37:33 AM: Started restoring cached ruby gems
10:37:33 AM: Finished restoring cached ruby gems
10:37:33 AM: Started restoring cached go cache
10:37:35 AM: Finished restoring cached go cache
10:37:35 AM: Installing Go version 1.10
10:37:37 AM: failed during stage 'building site': Build script returned non-zero exit code: 42
10:37:35 AM: unset GOOS;
10:37:37 AM: Shutting down logging, 30 messages pending

Please provide a link to your live site hosted on Netlify

What have you tried as far as troubleshooting goes? Do you have an idea what is causing the problem?

I have no idea what causes the problem. : ( it has been ok and I didn’t change anything.

1 Like

This is solved (Thank you very much @Laura Jodz (Netlify) ). In case other people have similar problem. Here is what you can do to debug.

This is the instruction from Laura:

I changed the build command and got the logs. It indicated the problem of blunder version:

10:47:44 AM: Activating bundler (2.0.1) failed:

10:47:44 AM: Could not find 'bundler' (= 2.0.1) - did find: [bundler-2.0.2]

So I went back to change the Gemfile.lock file to set:


then followed the suggestion from this doc: to run a build locally to make sure everything is ok then pushed to GitHub. Problem solved!!


@happyrabbit So glad to hear that helped you in your debugging!

HI Happyrabbit, I had exactly the same problem as you had. Changing the bundler version in Gemfile.lock fixed the issue.

1 Like