Machine unable to use/update Bundler 2.0

Bitrise Build Issue Report template

Description of the issue

The Bitrise machine is unable to update the bundler gem to 2.0, crashing when trying to install fastlane for builds in projects that have a Gemfile.lock generated with bundler 2.0.

Example of crash:

I tried to create a simple script to update the bundler to 2.0 before doing any gem install, but it also fails.

Script:

bundle check
BUNDLE_CHECK_RESULT=$?

if [[ BUNDLE_CHECK_RESULT -eq 0 ]]; then
    echo "All fine, all good with bundler"
else
    echo "Updating bundler"
    gem install bundler
    echo "$( gem list | grep bundler )"
    bundle install
fi

Result:

You must use Bundler 2 or greater with this lockfile.
Updating bundler
ERROR:  Error installing bundler:
	"bundle" from bundler conflicts with /usr/local/bin/bundle
Updating installed gems
Updating bundler
Gems updated: bundler
bundler (default: 1.16.2)
You must use Bundler 2 or greater with this lockfile.

Example of Gemfile that can cause the issue:

GEM
  remote: https://rubygems.org/
  specs:
    CFPropertyList (3.0.0)
    activesupport (4.2.11)
      i18n (~> 0.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    atomos (0.1.3)
    claide (1.0.2)
    cocoapods (1.5.3)
      activesupport (>= 4.0.2, < 5)
      claide (>= 1.0.2, < 2.0)
      cocoapods-core (= 1.5.3)
      cocoapods-deintegrate (>= 1.0.2, < 2.0)
      cocoapods-downloader (>= 1.2.0, < 2.0)
      cocoapods-plugins (>= 1.0.0, < 2.0)
      cocoapods-search (>= 1.0.0, < 2.0)
      cocoapods-stats (>= 1.0.0, < 2.0)
      cocoapods-trunk (>= 1.3.0, < 2.0)
      cocoapods-try (>= 1.1.0, < 2.0)
      colored2 (~> 3.1)
      escape (~> 0.0.4)
      fourflusher (~> 2.0.1)
      gh_inspector (~> 1.0)
      molinillo (~> 0.6.5)
      nap (~> 1.0)
      ruby-macho (~> 1.1)
      xcodeproj (>= 1.5.7, < 2.0)
    cocoapods-core (1.5.3)
      activesupport (>= 4.0.2, < 6)
      fuzzy_match (~> 2.0.4)
      nap (~> 1.0)
    cocoapods-deintegrate (1.0.2)
    cocoapods-downloader (1.2.2)
    cocoapods-plugins (1.0.0)
      nap
    cocoapods-search (1.0.0)
    cocoapods-stats (1.0.0)
    cocoapods-trunk (1.3.1)
      nap (>= 0.8, < 2.0)
      netrc (~> 0.11)
    cocoapods-try (1.1.0)
    colored2 (3.1.2)
    concurrent-ruby (1.1.4)
    escape (0.0.4)
    factory_girl (4.9.0)
      activesupport (>= 3.0.0)
    fourflusher (2.0.1)
    fuzzy_match (2.0.4)
    gh_inspector (1.1.3)
    i18n (0.9.5)
      concurrent-ruby (~> 1.0)
    jbuilder (2.8.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    minitest (5.11.3)
    molinillo (0.6.6)
    multi_json (1.13.1)
    mustermann (1.0.3)
    nanaimo (0.2.6)
    nap (1.1.0)
    netrc (0.11.0)
    rack (2.0.6)
    rack-protection (2.0.5)
      rack
    ruby-macho (1.3.1)
    sinatra (2.0.5)
      mustermann (~> 1.0)
      rack (~> 2.0)
      rack-protection (= 2.0.5)
      tilt (~> 2.0)
    thread_safe (0.3.6)
    tilt (2.0.9)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    xcodeproj (1.7.0)
      CFPropertyList (>= 2.3.3, < 4.0)
      atomos (~> 0.1.3)
      claide (>= 1.0.2, < 2.0)
      colored2 (~> 3.1)
      nanaimo (~> 0.2.6)

PLATFORMS
  ruby

DEPENDENCIES
  cocoapods
  factory_girl
  jbuilder
  sinatra

BUNDLED WITH
   2.0.1

Environment:

Where did the issue happen?

Bitrise.io: Xcode 10.1.x, on macOS 10.13 (High Sierra)

Which build Step causes the issue and which version of the step?

Custom step: GitHub - FutureWorkshops/bitrise-step-download-provisioning-profile

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : I start to notice the issue after updating the Gemfile.lock to 2.0

Local reproduction

Locally, a gem install bundler or gem update bundler solves the issue. But it is not being accepted on Bitrise machine because of conflict with other bundler installation.

Build log

2 Likes

Hello there!

now it is kind of a known issue, we did not already came out with a fix, but a workaround would be to uninstall and reinstall bundler in a script step.

@fehersanyi-bitrise How can I uninstall the bundler? A “simple” approach of running gem uninstall bundler do not work, and give me the error:

Uninstalling bundler
Gem 'bundler' is not installed

Installing bundler, version 2.0.1
ERROR: Error installing bundler:
"bundle" from bundler conflicts with /usr/local/bin/bundle

Like I tried, and showed in the step that I linked in this bug report.

Any updates on this? Also having the same issue.

With the help of @fehersanyi-bitrise, I managed to solve the issue on my process. By using the --force on gem commands. Example:

gem uninstall bundler --force
gem install bundler --force

But, I created a step to check if this is necessary, and if it is, install the bundler version used to Bundle the Gemfile.lock of the project. If it is interesting for you, you can try out on:

5 Likes

Hy @FWIgor!

I just realised it yesterday as well, but had no time to get back on discuss.
I’m glad you found the solution. In two month at worth we will have a mayor update with the stacks and this issue will be fixed if everything goes well.
until then may the --force be with you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hi @FWIgor,
There is a new version of fastlane-install available (2.5.1):

Bundler is installed before executing bundle install, in case a Gemfile.lock is present. The specific version defined in the Gemfile.lock under BUNDLED WITH is installed and used to run the bundle install command.
The issues fixed include the error messages printed during build: rbenv: bundle: command not found
and You must use Bundler 2 or greater with this lockfile.

The fix is also available in:
cocoapods-install (Release 1.8.0 · bitrise-steplib/steps-cocoapods-install · GitHub)
deploy-to-itunesconnect-deliver (Release 2.16.0 · bitrise-steplib/steps-deploy-to-itunesconnect-deliver · GitHub)