Codeship - Bundle install error (You must use bundler 2 or greater with this lockfile)
Asked Answered
B

3

7

I am trying to run some tests on Codeship with Ruby 2.7.0 and Rails 6.0.2.2.

The Error: When we try to push a new change, we get a build error that says 'You must use bundler 2 or greater with this lockfile'.

What I've tried: To amend this, I tried to add the following line: gem install -v bundler 2.1.4. However, after that was included in my pipeline, we then got a recursive locking error.

When I run 'gem list | grep "bundle"' I get the following:

bundler (default: 2.1.2, 1.17.1)

My Gemfile.lock looks like this:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.0.2.2)
      actionpack (= 6.0.2.2)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.2.2)
      actionpack (= 6.0.2.2)
      activejob (= 6.0.2.2)
      activerecord (= 6.0.2.2)
      activestorage (= 6.0.2.2)
      activesupport (= 6.0.2.2)
      mail (>= 2.7.1)
    actionmailer (6.0.2.2)
      actionpack (= 6.0.2.2)
      actionview (= 6.0.2.2)
      activejob (= 6.0.2.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.2.2)
      actionview (= 6.0.2.2)
      activesupport (= 6.0.2.2)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.0.2.2)
      actionpack (= 6.0.2.2)
      activerecord (= 6.0.2.2)
      activestorage (= 6.0.2.2)
      activesupport (= 6.0.2.2)
      nokogiri (>= 1.8.5)
    actionview (6.0.2.2)
      activesupport (= 6.0.2.2)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.0.2.2)
      activesupport (= 6.0.2.2)
      globalid (>= 0.3.6)
    activemodel (6.0.2.2)
      activesupport (= 6.0.2.2)
    activerecord (6.0.2.2)
      activemodel (= 6.0.2.2)
      activesupport (= 6.0.2.2)
    activerecord-import (1.0.4)
      activerecord (>= 3.2)
    activestorage (6.0.2.2)
      actionpack (= 6.0.2.2)
      activejob (= 6.0.2.2)
      activerecord (= 6.0.2.2)
      marcel (~> 0.3.1)
    activesupport (6.0.2.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    autoprefixer-rails (9.7.6)
      execjs
    awesome_print (1.8.0)
    bcrypt (3.1.13)
    better_errors (2.6.0)
      coderay (>= 1.0.0)
      erubi (>= 1.0.0)
      rack (>= 0.9.0)
    bindex (0.8.1)
    binding_of_caller (0.8.0)
      debug_inspector (>= 0.0.1)
    bootsnap (1.4.6)
      msgpack (~> 1.0)
    bootstrap (4.3.1)
      autoprefixer-rails (>= 9.1.0)
      popper_js (>= 1.14.3, < 2)
      sassc-rails (>= 2.0.0)
    bootstrap-sass (3.4.1)
      autoprefixer-rails (>= 5.2.1)
      sassc (>= 2.0.0)
    bootstrap_form (4.4.0)
      actionpack (>= 5.0)
      activemodel (>= 5.0)
    builder (3.2.4)
    byebug (11.1.2)
    capybara (3.32.1)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (~> 1.5)
      xpath (~> 3.2)
    childprocess (3.0.0)
    chronic (0.10.2)
    coderay (1.1.2)
    coffee-rails (5.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 5.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.1.6)
    crass (1.0.6)
    debug_inspector (0.0.3)
    declarative (0.0.10)
    declarative-option (0.1.0)
    digest-crc (0.5.1)
    dotenv (2.7.5)
    dotenv-rails (2.7.5)
      dotenv (= 2.7.5)
      railties (>= 3.2, < 6.1)
    erubi (1.9.0)
    execjs (2.7.0)
    faker (2.11.0)
      i18n (>= 1.6, < 2)
    faraday (1.0.1)
      multipart-post (>= 1.2, < 3)
    ffi (1.12.2)
    font_awesome5_rails (1.1.1)
      railties (>= 4.2)
    geocoder (1.6.2)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    google-api-client (0.38.0)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (~> 0.9)
      httpclient (>= 2.8.1, < 3.0)
      mini_mime (~> 1.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
      signet (~> 0.12)
    google-cloud-core (1.5.0)
      google-cloud-env (~> 1.0)
      google-cloud-errors (~> 1.0)
    google-cloud-env (1.3.1)
      faraday (>= 0.17.3, < 2.0)
    google-cloud-errors (1.0.0)
    google-cloud-storage (1.26.0)
      addressable (~> 2.5)
      digest-crc (~> 0.4)
      google-api-client (~> 0.33)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.9)
      mini_mime (~> 1.0)
    googleauth (0.12.0)
      faraday (>= 0.17.3, < 2.0)
      jwt (>= 1.4, < 3.0)
      memoist (~> 0.16)
      multi_json (~> 1.11)
      os (>= 0.9, < 2.0)
      signet (~> 0.14)
    httpclient (2.8.3)
    i18n (1.8.2)
      concurrent-ruby (~> 1.0)
    jbuilder (2.10.0)
      activesupport (>= 5.0.0)
    jquery-rails (4.3.5)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (2.3.0)
    jwt (2.2.1)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.5.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    memoist (0.16.2)
    method_source (1.0.0)
    mimemagic (0.3.4)
    mini_mime (1.0.2)
    mini_portile2 (2.4.0)
    minitest (5.14.0)
    msgpack (1.3.3)
    multi_json (1.14.1)
    multipart-post (2.1.1)
    nio4r (2.5.2)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    os (1.1.0)
    pg (1.2.3)
    popper_js (1.16.0)
    public_suffix (4.0.4)
    puma (4.3.3)
      nio4r (~> 2.0)
    rack (2.2.2)
    rack-proxy (0.6.5)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.2.2)
      actioncable (= 6.0.2.2)
      actionmailbox (= 6.0.2.2)
      actionmailer (= 6.0.2.2)
      actionpack (= 6.0.2.2)
      actiontext (= 6.0.2.2)
      actionview (= 6.0.2.2)
      activejob (= 6.0.2.2)
      activemodel (= 6.0.2.2)
      activerecord (= 6.0.2.2)
      activestorage (= 6.0.2.2)
      activesupport (= 6.0.2.2)
      bundler (>= 1.3.0)
      railties (= 6.0.2.2)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.5)
    rails_stdout_logging (0.0.5)
    railties (6.0.2.2)
      actionpack (= 6.0.2.2)
      activesupport (= 6.0.2.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rake (13.0.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redis (4.1.3)
    regexp_parser (1.7.0)
    representable (3.0.4)
      declarative (< 0.1.0)
      declarative-option (< 0.2.0)
      uber (< 0.2.0)
    retriable (3.1.2)
    ruby_dep (1.5.0)
    rubyzip (2.3.0)
    sass-rails (6.0.0)
      sassc-rails (~> 2.1, >= 2.1.1)
    sassc (2.3.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    signet (0.14.0)
      addressable (~> 2.3)
      faraday (>= 0.17.3, < 2.0)
      jwt (>= 1.5, < 3.0)
      multi_json (~> 1.10)
    simple_form (5.0.2)
      actionpack (>= 5.0)
      activemodel (>= 5.0)
    spring (2.1.0)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (4.0.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.4.2)
    thor (1.0.1)
    thread_safe (0.3.6)
    tilt (2.0.10)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    uber (0.1.0)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    web-console (4.0.1)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (4.3.0)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (>= 3.0, < 4.0)
    webpacker (4.2.2)
      activesupport (>= 4.2)
      rack-proxy (>= 0.6.1)
      railties (>= 4.2)
    websocket-driver (0.7.1)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.4)
    whenever (1.0.0)
      chronic (>= 0.6.3)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.3.0)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord-import
  awesome_print
  bcrypt
  better_errors
  binding_of_caller
  bootsnap (>= 1.4.2)
  bootstrap (~> 4.3.1)
  bootstrap-sass
  bootstrap_form (~> 4.0)
  byebug
  capybara (>= 2.15)
  coffee-rails
  dotenv-rails
  faker
  font_awesome5_rails
  geocoder
  google-cloud-storage (~> 1.8)
  jbuilder (~> 2.7)
  jquery-rails
  json
  listen (>= 3.0.5, < 3.2)
  pg (~> 1.2)
  puma (~> 4.1)
  rails (~> 6.0.2, >= 6.0.2.1)
  rails_12factor
  redis
  sass-rails (>= 6)
  selenium-webdriver
  simple_form
  spring
  spring-watcher-listen (~> 2.0.0)
  sqlite3
  turbolinks (~> 5)
  tzinfo-data
  uglifier
  web-console (>= 3.3.0)
  webdrivers
  webpacker (~> 4.0)
  whenever

RUBY VERSION
   ruby 2.7.0p0

BUNDLED WITH
   2.1.2

New error:

Exporting Environment
00:00
git clone --branch "codeship-issue" --depth 50 [email protected]:username/myapp.git ~/src/github.com/username/myapp
00:05
cd clone
00:00
git checkout -qf 2a3698ffd722399e5c1ac8b7fa0abbd9722164fa
00:00
No output generated
Preparing Dependency Cache
00:14
Preparing Bionic Build Container
00:12
if [ -f .ruby-version ]; then rvm use $(cat .ruby-version) --install; fi
00:00
gem install bundler -v 2.1.4
00:00
bundle install
00:02
Traceback (most recent call last):
00:02
    12: from /home/rof/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
00:02
    11: from /home/rof/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
00:02
    10: from /home/rof/.rvm/gems/ruby-2.7.0/bin/bundle:23:in `<main>'
00:02
     9: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `activate_bin_path'
00:02
     8: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `synchronize'
00:02
     7: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems.rb:306:in `block in activate_bin_path'
00:02
     6: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems.rb:243:in `finish_resolve'
00:02
     5: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `resolve_current'
00:02
     4: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `new'
00:02
     3: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/resolver/set.rb:24:in `initialize'
00:02
     2: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:42:in `require'
00:02
     1: from /home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `gem'
00:02
/home/rof/.rvm/rubies/ruby-2.7.0/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `synchronize': deadlock; recursive locking (ThreadError)
Billiot answered 20/4, 2020 at 17:5 Comment(0)
C
11

I had the same issue, and bundle update --system did not fix the issue, as others have suggested.

Using binstubs everywhere in my env and test setup did. e.g. bin/bundle, bin/rails, etc.

I suspect maybe there is a PATH issue that the using binstubs gets around.

Crowberry answered 2/7, 2020 at 20:5 Comment(3)
I also had to include gem install bundler -v '2.1.4' before the bin/bundle install command.Microbiology
Also try gem update --system before bundle update --system. That was required for us.Roth
Yep, adding bin was what fixed it for me. Thanks @CrowberryCaines
M
15

For me gem update --system worked smoothly. However after that I noticed following warning

Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.

to resolve which I added gem install bundler:2.1.4 as per the instruction and the warning went away.

References:

https://github.com/jekyll/jekyll/issues/7463#issuecomment-451686361

Manlike answered 28/4, 2020 at 22:41 Comment(1)
If you specify the version of bundler to use in your Gemfile with gem "bundler", "2.1.4" then you should be able to just run bundle update --bundler after gem update --system and it should update the bundler gem to the one specified in your Gemfile, removing all warnings/errors you're seeing.Roth
C
11

I had the same issue, and bundle update --system did not fix the issue, as others have suggested.

Using binstubs everywhere in my env and test setup did. e.g. bin/bundle, bin/rails, etc.

I suspect maybe there is a PATH issue that the using binstubs gets around.

Crowberry answered 2/7, 2020 at 20:5 Comment(3)
I also had to include gem install bundler -v '2.1.4' before the bin/bundle install command.Microbiology
Also try gem update --system before bundle update --system. That was required for us.Roth
Yep, adding bin was what fixed it for me. Thanks @CrowberryCaines
B
1

It looks like the following line before bundle install worked:

bundle update --system
Billiot answered 20/4, 2020 at 18:1 Comment(3)
FWIW, I had the same issue, and bundle update --system did not fix the issue, but using binstubs everywhere instead did, e.g. bin/bundle, bin/rails, etc.Crowberry
@Crowberry you should post your tip as an actual answer. Worked for me as well.Microbiology
@Microbiology Just created it. Glad it helped you out!Crowberry

© 2022 - 2024 — McMap. All rights reserved.