Jekyll build failing - non-zero exit code: 2

Site name - kq-jekyll.netlify.app

Hey folks,

So I’m having issues building my Jekyll sites this morning, the build log is failing with a couple of errors:

9:28:39 AM:   Command failed with exit code 42: bundle exec jekyll build (https://ntl.fyi/exit-code-42)
9:28:40 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)

The entire build log can be found on Pastebin here - Netlify output - Pastebin.com

This is happening on both of my Jekyll sites, same error too. But they both build locally just fine:

% bundle exec jekyll build
Configuration file: /Users/kev/GitHub/kq-jekyll/_config.yml
            Source: /Users/kev/GitHub/kq-jekyll
       Destination: /Users/kev/GitHub/kq-jekyll/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 3.052 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

I’ve tried running a bundle update locally, to see if any of my gems were out of date versus Netlify, but that hasn’t fixed the problem. I also tried test deleting the netlify.toml file in case it was something wonky with the cache, but that didn’t work either. The only thing my netlify.toml file does is cache fonts anyway:

[[headers]]
  for = "/assets/fonts/*"
    [headers.values]
    Cache-Control = "public, max-age=31536000"

The logs don’t give me much to go on, so hoping someone here may be able to help please?

Thanks!

1 Like

I have the same problem as of yesterday (21 Feb) - I’ve updated my bundler, but the problem persists:

9:23:11 AM: $ jekyll build
9:23:11 AM: Activating bundler (~> 2.4) failed:
9:23:11 AM: Could not find 'bundler' (2.4.7) required by your /opt/build/repo/Gemfile.lock.
9:23:11 AM: To update to the latest version installed on your system, run `bundle update --bundler`.
9:23:11 AM: To install the missing version, run `gem install bundler:2.4.7`
9:23:11 AM: Checked in 'GEM_PATH=/opt/buildhome/.gem/ruby/2.7.0:/opt/buildhome/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0', execute `gem env` for more information
9:23:11 AM: To install the version of bundler this project requires, run `gem install bundler -v '~> 2.4'`
9:23:11 AM: ​
9:23:11 AM:   "build.command" failed                                        
9:23:11 AM: ────────────────────────────────────────────────────────────────
9:23:11 AM: ​
9:23:11 AM:   Error message
9:23:11 AM:   Command failed with exit code 42: jekyll build (https://ntl.fyi/exit-code-42)

Hi both :wave:t6: @keq @yorkshiremoose I’m so sorry you were impacted by this Jekyll building incident. We have rollback the change that caused these builds to fail and this should not be the case. Can you please re-deploy and confirm if you are still experiencing this issue>

Hey Sam,

Thanks for the reply. Can confirm that all is well in my little Jekyll world now. :slight_smile:

Kev

We’re having the same issue today… We haven’t touched anything on the configurations and then suddenly our builds failing. Here’s the logs below

7:43:09 AM: Activating bundler (~> 2.4) failed:
7:43:09 AM: Could not find 'bundler' (2.4.9) required by your /opt/build/repo/Gemfile.lock.
7:43:09 AM: To update to the latest version installed on your system, run `bundle update --bundler`.
7:43:09 AM: To install the missing version, run `gem install bundler:2.4.9`
7:43:09 AM: Checked in 'GEM_PATH=/opt/buildhome/.rvm/gems/ruby-2.6.3@apex_sites3:/opt/buildhome/.rvm/gems/ruby-2.6.3@global', execute `gem env` for more information
7:43:09 AM: To install the version of bundler this project requires, run `gem install bundler -v '~> 2.4'`
7:43:09 AM: ​
7:43:09 AM:   "build.command" failed                                        
7:43:09 AM: ────────────────────────────────────────────────────────────────
7:43:09 AM: ​
7:43:09 AM:   Error message
7:43:09 AM:   Command failed with exit code 42: jekyll build --config _config.yml,_config.staging.yml (https://ntl.fyi/exit-code-42)

We have no problem with this until now.

What is your site name?/slug or ID.

First, have you looked through this resource? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share the following information:

  • the name of your build instance: β€œexample-jones.netlify.com”
  • what you have already tried
  • any error messages you have received in your terminal window or in the developer console

Nvm @SamO we’ve figured it out, we just need to downgrade bundler to 1.17.2, we just don’t know why an older version work and much more updated version does not work.