Deploy fails non-zero exit code on bundler install

My deployment previews are failing due to bundler install errors:

2:48:28 AM: Build ready to start
2:48:32 AM: build-image version: 72a309a113b53ef075815b129953617827965e48 (focal)
2:48:32 AM: build-image tag: v4.8.2
2:48:32 AM: buildbot version: 72ebfe61ef7a5152002962d9129cc52f5b1bb560
2:48:32 AM: Fetching cached dependencies
2:48:32 AM: Finished downloading cache in 574.704676ms
2:48:32 AM: Starting to extract cache
2:48:36 AM: Finished extracting cache in 3.854688593s
2:48:36 AM: Finished fetching cache in 4.461230192s
2:48:36 AM: Starting to prepare the repo for build
2:48:37 AM: Preparing Git Reference pull/138/head
2:48:37 AM: Parsing package.json dependencies
2:48:37 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'git submodule update --init --remote && bundle exec jekyll build --config '_config.yml,_config_staging.yml'' versus 'bundle exec jekyll build --config '_config.yml,_config_staging.yml'' in the Netlify UI
2:48:38 AM: Starting build script
2:48:38 AM: Installing dependencies
2:48:38 AM: Python version set to 2.7
2:48:38 AM: Started restoring cached node version
2:48:39 AM: Finished restoring cached node version
2:48:39 AM: v16.15.1 is already installed.
2:48:40 AM: Now using node v16.15.1 (npm v8.11.0)
2:48:40 AM: Started restoring cached build plugins
2:48:40 AM: Finished restoring cached build plugins
2:48:40 AM: Attempting ruby version 2.6.2, read from environment
2:48:40 AM: Started restoring cached ruby version
2:48:40 AM: Finished restoring cached ruby version
2:48:41 AM: Using ruby version 2.6.2
2:48:41 AM: Using bundler version 2.3.10 from Gemfile.lock
2:48:42 AM: ERROR:  Error installing bundler:
2:48:42 AM: 	"bundler" from bundler conflicts with /opt/buildhome/.rvm/gems/ruby-2.6.2/bin/bundler
2:48:42 AM: Error installing bundler
2:48:42 AM: Build was terminated: Build script returned non-zero exit code: 1
2:48:42 AM: Creating deploy upload records
2:48:42 AM: Failing build: Failed to build site
2:48:42 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
2:48:42 AM: Finished processing build request in 10.26317364s

As a workaround, clearing the cache manually has worked, but automatic builds still fail. I’d like to get away from manually clearing the cache.

Here is the Gemfile.lock for reference as well:

PATH
  remote: _external/data/wai-gems
  specs:
    wai-gems (1.0.0)
      jekyll-github-metadata
      jekyll-include-cache
      jekyll-paginate
      jekyll-redirect-from
      jekyll-relative-links
      jekyll-remote-theme
      jekyll-seo-tag
      jekyll-sitemap
      wai-website-plugin

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    colorator (1.1.0)
    concurrent-ruby (1.1.10)
    em-websocket (0.5.3)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0)
    eventmachine (1.2.7)
    faraday (2.3.0)
      faraday-net_http (~> 2.0)
      ruby2_keywords (>= 0.0.4)
    faraday-net_http (2.0.3)
    ffi (1.15.5)
    forwardable-extended (2.6.0)
    http_parser.rb (0.8.0)
    i18n (1.10.0)
      concurrent-ruby (~> 1.0)
    jekyll (4.2.2)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 1.0)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.3)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.4.0)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 2.0)
    jekyll-github-metadata (2.15.0)
      jekyll (>= 3.4, < 5.0)
      octokit (~> 4.0, != 4.4.0)
    jekyll-include-cache (0.2.1)
      jekyll (>= 3.7, < 5.0)
    jekyll-paginate (1.1.0)
    jekyll-redirect-from (0.16.0)
      jekyll (>= 3.3, < 5.0)
    jekyll-relative-links (0.6.1)
      jekyll (>= 3.3, < 5.0)
    jekyll-remote-theme (0.4.3)
      addressable (~> 2.0)
      jekyll (>= 3.5, < 5.0)
      jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
      rubyzip (>= 1.3.0, < 3.0)
    jekyll-sass-converter (2.2.0)
      sassc (> 2.0.1, < 3.0)
    jekyll-seo-tag (2.8.0)
      jekyll (>= 3.8, < 5.0)
    jekyll-sitemap (1.4.0)
      jekyll (>= 3.7, < 5.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.4.0)
      rexml
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.3)
    listen (3.7.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    mercenary (0.4.0)
    mini_portile2 (2.8.0)
    nokogiri (1.13.6)
      mini_portile2 (~> 2.8.0)
      racc (~> 1.4)
    octokit (4.25.0)
      faraday (>= 1, < 3)
      sawyer (~> 0.9)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (4.0.7)
    racc (1.6.0)
    rb-fsevent (0.11.1)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    rexml (3.2.5)
    rouge (3.29.0)
    ruby2_keywords (0.0.5)
    rubyzip (2.3.2)
    safe_yaml (1.0.5)
    sassc (2.4.0)
      ffi (~> 1.9)
    sawyer (0.9.2)
      addressable (>= 2.3.5)
      faraday (>= 0.17.3, < 3)
    terminal-table (2.0.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    unicode-display_width (1.8.0)
    wai-website-plugin (0.2)
      jekyll (>= 3.6, < 5.0)

PLATFORMS
  ruby

DEPENDENCIES
  nokogiri
  wai-gems!

BUNDLED WITH
   2.3.10

This is for site - https://wai-aria-practices2.netlify.app

There is something very strange going on with the cache

If I manually build in Netlify web app without cache it’s fine. But the next manual build with cache fails. Surely a build without cache should reset the cache?

It’s only this repository - others are all fine. I cannot see anything in config that is different.

I tried varying the bundler version used but that made no difference.

Thanks

PS local netlify dev works fine (but that doesn’t use caching)

This is a problem for us (W3C WAI) as the team developing the code in the repo do not have Netlify Team access. That would provide too much access. We really need finer grained access controls to Netlify site.

This is really appears to be a Netlify bug - at minimum the exact error should be reported.

I discovered a work-around is to swap the Netlify build container Image to be the Xenial Ubuntu one rather than default latest Focal. This is a newer repo/site so that might be why only this one exhibits problems - though the problem seems to have recently started for some PRs, as if the image has been updated.

I don’t have time to build and debug the netlify image locally so the work around will have to do until the cause is found in our code and/or Netlify fix it.

Hi !

I have exactly the same problem since June 25, my jekyll site does not want to build because of a conflict with the bundler version. If I clean the cache, it works but every build afterwards ends with the same error:

2:19:57 PM: Using ruby version 2.6.2
2:19:57 PM: Using bundler version 2.3.17 from Gemfile.lock
2:19:58 PM: ERROR: Error installing bundler:
2:19:58 PM: "bundler" from bundler conflicts with /opt/buildhome/.rvm/gems/ruby-2.6.2/bin/bundler
2:19:58 PM: Error installing bundler
2:19:58 PM: Build was terminated: Build script returned non-zero exit code: 1

My site builds locally, and I have updated the bundler version. I could downgrade the bundler version but I don’t know what version Netlify uses in its image.

Thanks for the tip to switch back to the old xenial image, it works until I can switch back to focal.

I hope to find a solution !

1 Like

Glad it helped you too!

To be honest I don’t care which version of Ubuntu is used, as long as the tools work. I’m guessing this repo only used a different one as is new, and the default changed.

The source code for the image is on github but after a quick scan I could not figure the bundle version. It seems to get it via curl without specifying a version.

Our other repositories seem to use a range of bundler versions with about, 3.10 being latest.

1 Like

I want to chime in that we are also experiencing this same issue with bundler erroring out on install for deploy previews. Rerunning the deploy without cache builds successfully.

Our project is an older Middleman blog running on Ruby 2.7.5 and Bundler 2.3.6.

The problems started around June 15, which is in line with another individual who posted earlier.

Here is the deploy log:

7:51:07 PM: Build ready to start
7:51:09 PM: build-image version: 72a309a113b53ef075815b129953617827965e48 (focal)
7:51:09 PM: build-image tag: v4.8.2
7:51:09 PM: buildbot version: 515e5c33287d8b909c004fcf2e460e8645e8c1c6
7:51:09 PM: Fetching cached dependencies
7:51:14 PM: Finished downloading cache in 5.340034263s
7:51:14 PM: Starting to extract cache
7:51:22 PM: Finished extracting cache in 7.973055495s
7:51:22 PM: Finished fetching cache in 13.36015666s
7:51:22 PM: Starting to prepare the repo for build
7:51:23 PM: Preparing Git Reference pull/724/head
7:51:24 PM: Parsing package.json dependencies
7:51:24 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'middleman build --verbose && cp netlify_headers_for_build build/_headers' versus 'middleman build' in the Netlify UI
7:51:25 PM: Starting build script
7:51:25 PM: Installing dependencies
7:51:25 PM: Python version set to 2.7
7:51:25 PM: Started restoring cached node version
7:51:26 PM: Finished restoring cached node version
7:51:26 PM: v8.17.0 is already installed.
7:51:26 PM: Now using node v8.17.0 (npm v6.13.4)
7:51:27 PM: Started restoring cached build plugins
7:51:27 PM: Finished restoring cached build plugins
7:51:27 PM: Required ruby-2.7.5 is not installed.
7:51:27 PM: To install do: 'rvm install "ruby-2.7.5"'
7:51:27 PM: Attempting ruby version 2.7.5, read from .ruby-version file
7:51:27 PM: Started restoring cached ruby version
7:51:27 PM: Finished restoring cached ruby version
7:51:28 PM: Using ruby version 2.7.5
7:51:28 PM: Using bundler version 2.3.6 from Gemfile.lock
7:51:29 PM: ERROR:  Error installing bundler:
7:51:29 PM: 	"bundle" from bundler conflicts with /opt/buildhome/.rvm/gems/ruby-2.7.5/bin/bundle
7:51:29 PM: Error installing bundler
7:51:29 PM: Build was terminated: Build script returned non-zero exit code: 1
7:51:29 PM: Creating deploy upload records
7:51:29 PM: Failing build: Failed to build site
7:51:29 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
7:51:29 PM: Finished processing build request in 20.008551436s

We are also running on the latest Focal image. I would prefer we didn’t have to revert back to Xenial. We have been running on Focal without issue much earlier than June 15 (when the issue started). We haven’t done any dependency updates on our project within the timeline, so it is making me believe that something on Netlify’s end has changed.

Any solution to this issue which keeps us on Focal would be greatly appreciated.

hey everyone, thanks for your great error reports and all the information. The team agrees something is up and is going to investigate. We’ll be in touch here soon.

2 Likes

Hey folks - if you are affected by this, you should still be able to build right now, if you either:

  • clear cache and retry deploy (using the button at the top of your failed deploy logs:

image

or

  • temporarily switch to Xenial as @slim mentioned. This is not a long term fix and this image will be deprecated soon since it has reached end of life, but it will likely work better for you until we can get a fix live tomorrow.

It’s also possible (I have not tested) that switching to a ruby version image not included in the build image (what’s included? look here: build-image/included_software.md at focal · netlify/build-image · GitHub) may allow things to work, but of course, you’d need to verify that your code builds correctly in that version; we cannot guarantee that it will.

As @perry mentioned, we have escalated this to our dev team but I think the fix may not come out til tomorrow, so hopefully you can use the workaround(s) for now.

We will as Perry promised, follow up in this thread once a long-term fix is live.

3 Likes

A post was split to a new topic: Trouble installing NPM packages

To clarify the only build that DOES work is the manual one you show WITHOUT cache.

The CD integration with GitHub PR breaks and our devs cannot access that button as they are not Netlify Team members.

Heya @slim and thanks for all your help here and always :slight_smile:

Perhaps I misunderstood something! Are you saying that the downgrade to Xenial stopped working since your earlier post? Or perhaps I misinterpreted and you had to clear cache on either build image, so it was no better on Xenial? Or you were just confirming my screenshot was correct or suggesting it was incorrect?

1 Like

Sorry @fool, I see that is a bit unclear.

I was only saying that running a single manual deploy without cache is not a one time fix. You have to do every single deploy that way. Github CD is broken as it always uses the cache.

So our CD only users have to keep requesting a team member manually run the non cached deploy. #fail

Xenial is a good workaround, fixing the problem and letting GitHub Deploy Previews work again.

hey all, we made some changes that we think fixed this issue. can you all retry in your original configurations and see if things work as expected now? please let me knof it you do see any errors.

3 Likes

Looks like the changes addressed the issue for us. The auto deploys are now building successfully with cache.

3 Likes

It’s fixed for me too, thanks for your work ! My site is now building from the cache with the focal image :wink:

1 Like

Thanks for coming back and letting us know. Happy building! :rocket:

1 Like