Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

bundler version 2.0.1 fails to run #6882

Closed
electriquo opened this issue Jan 5, 2019 · 32 comments
Closed

bundler version 2.0.1 fails to run #6882

electriquo opened this issue Jan 5, 2019 · 32 comments
Assignees

Comments

@electriquo
Copy link

it feels like there is a bug with bundler, please see blow

$ bundle --version
Bundler version 1.17.3
$ bundle exec
bundler: exec needs a command to run

$ sudo gem uninstall bundler --quiet --silent
$ sudo gem list | grep bundler

$ sudo gem install bundler
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed

$ bundle --version
Traceback (most recent call last):
	2: from /usr/local/bin/bundle:23:in `<main>'
	1: from /usr/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/usr/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

$ bundle exec
Traceback (most recent call last):
	2: from /usr/local/bin/bundle:23:in `<main>'
	1: from /usr/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/usr/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

$ sudo gem install bundler --version 1.17.3
Fetching: bundler-1.17.3.gem (100%)
Successfully installed bundler-1.17.3
1 gem installed

$ sudo gem install bundler --version 1.17.3
Fetching: bundler-1.17.3.gem (100%)
Successfully installed bundler-1.17.3
1 gem installed

$ ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic
@colby-swandale
Copy link
Member

Please see https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html

@electriquo
Copy link
Author

@colby-swandale: thank you!

i resolved it by deleting Gemfile.lock and recreating it using bundler 2.0.1.

@noraj
Copy link

noraj commented Jan 7, 2019

@colby-swandale I read the blog post but downgrading gem install bundler -v '1.17.3' is just a workaround and is still problematic, for example for CI scripts.

@anatol
Copy link

anatol commented Jan 8, 2019

I have this weird issue when I try to build Arch Linux metasploit package with bundler 2.0.1. I fixed the problem by removing BUNDLED WITH section from Gemfile.lock.

@foutrelis
Copy link

To add to what @anatol said, we also have rubygems 3.0.2 but it still doesn't seem to be able to update the Gemfile.lock to v2 of bundler:

/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (1.16.6) required by your /build/metasploit/src/metasploit-framework-4.17.31/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.6`
	from /usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
	from /usr/bin/bundle:23:in `<main>'

@deivid-rodriguez
Copy link
Member

bundle update --bundler does not do the trick there?

@foutrelis
Copy link

bundle update --bundler does not do the trick there?

I'm afraid not; I still get the same error message when running your command.

@deivid-rodriguez
Copy link
Member

Well, that seems definitely a bug. We shouldn't recommend solutions that don't work. I'll try to repro this.

@ShamoX
Copy link

ShamoX commented Jan 9, 2019

It seems to be a ruby 2.5.x problem.
On my side I have the same problem on MacOS (rbenv, ruby 2.5.3), even outside any repository :

10:30 $ cd
✔ ~ 
10:33 $ bundle --version
Bundler version 1.17.3
✔ ~ 
10:34 $ which bundle
/Users/rlaures/.rbenv/shims/bundle
✔ ~ 
10:34 $ gem list bundle

*** LOCAL GEMS ***

bundler (2.0.1, 1.17.3)
✔ ~ 
10:34 $ gem uninstall bundler

Select gem to uninstall:
 1. bundler-1.17.3
 2. bundler-2.0.1
 3. All versions
> 3
Successfully uninstalled bundler-1.17.3
Remove executables:
	bundle, bundler

in addition to the gem? [Yn]  Y
Removing bundle
Removing bundler
Successfully uninstalled bundler-2.0.1
✔ ~ 
10:34 $ gem list bundle

*** LOCAL GEMS ***


✔ ~ 
10:36 $ gem install bundler
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
✔ ~ 
10:36 $ bundle --version
Traceback (most recent call last):
	2: from /Users/rlaures/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>'
	1: from /Users/rlaures/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/rlaures/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
✘-1 ~ 
10:36 $

For me (but I'm perhaps wrong), the blog statements are not taking care of this situation. This is strange because I get it working in an other ruby version 2.4.1 :

10:36 $ rbenv global 2.4.1 
✔ ~ 
10:38 $ gem list bundler

*** LOCAL GEMS ***

bundler (1.16.2)
✔ ~ 
10:38 $ gem install bundler
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
✔ ~ 
10:38 $ bundle --version
Bundler version 2.0.1
✔ ~ 
10:38 $ gem uninstall bundler

Select gem to uninstall:
 1. bundler-1.16.2
 2. bundler-2.0.1
 3. All versions
> 1
Successfully uninstalled bundler-1.16.2
✔ ~ 
10:38 $ bundle --version
Bundler version 2.0.1
✔ ~ 
10:39 $ gem uninstall bundler
Remove executables:
	bundle, bundler

in addition to the gem? [Yn]  y
Removing bundle
Removing bundler
Successfully uninstalled bundler-2.0.1
✔ ~ 
10:40 $ bundle --version
rbenv: bundle: command not found

The `bundle' command exists in these Ruby versions:
  2.3.7
  2.5.3

✘-127 ~ 
10:40 $ gem install bundler
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
✔ ~ 
10:40 $ bundle --version
Bundler version 2.0.1
✔ ~ 

and 2.3.7 :

10:41 $ rbenv global 2.3.7 
✔ ~ 
10:41 $ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1)
✔ ~ 
10:41 $ bundle --version
Bundler version 2.0.1
✔ ~ 

@ShamoX
Copy link

ShamoX commented Jan 9, 2019

Just after installing the ruby 2.6.0, I get stuck to bundler 1.17.2 :

11:08 $ rbenv install 2.6.0
ruby-build: use openssl from homebrew
Downloading ruby-2.6.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.bz2
Installing ruby-2.6.0...
ruby-build: use readline from homebrew
Installed ruby-2.6.0 to /Users/rlaures/.rbenv/versions/2.6.0

✔ ~ 
11:16 $ rbenv global 2.6.0
✔ ~ 
11:16 $ gem install bundler
Fetching bundler-2.0.1.gem
Successfully installed bundler-2.0.1
1 gem installed
✔ ~ 
11:17 $ bundle --version
Bundler version 1.17.2
✔ ~ 
11:17 $ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1, default: 1.17.2)
✔ ~ 
11:17 $ gem uninstall bundler
✔ ~ 
11:17 $ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1, default: 1.17.2)
✔ ~ 
11:17 $ bundle --version
Bundler version 1.17.2
✔ ~

Probably an other Issue not to be adressed on this issue, but then I cannot tell you if it's doing the same thing as the 2.5 series.

@ShamoX
Copy link

ShamoX commented Jan 9, 2019

ARRRG !
I'm sorry, I got a terminal/console context problème... Closing and opening a new terminal solved the problem for me.
It seems, that it was executing all the ruby environment from a project repository. Which was indeed containing a Gemfile.lock...
I really don't know what was going on.

Deleting Gemfile.lock did the job on that repository and my others.

@hsbt hsbt self-assigned this Jan 21, 2019
@lkananowicz
Copy link

Is there any way to solve this without deleting Gemfile.lock?

@envygeeks
Copy link

On a side note, that message is way too unclear, when it broke our staging servers we had no idea what was going on, and just automatically downgraded and started auditing our servers for problems, nowhere did bundler even indicate the problem was that it was trying to auto switch, and that the version of Bundler we were using in our Gemfile.lock was outdated. I feel like just throwing out a random error and assuming we know the internals of Bundler is a bit cheeky.

@olliebennett
Copy link

Is there any way to solve this without deleting Gemfile.lock?

Rather than deleting the whole Gemfile.lock file, you can just delete the BUNDLED WITH section of that file;

BUNDLED WITH
   1.17.1

Another reasonable fix (if you're able to) is to update rubygems (as hinted by the linked blogpost above);

gem update --system

@lkananowicz
Copy link

lkananowicz commented Mar 12, 2019

@olliebennett Thanks, I go for #1 option.

gem update --system does not seem to work for bundler installed with gem install bundler --user-install command.

@bobvanderlinden
Copy link

I just ran into this issue as well after (apparently) updating bundler to 2.x.

From my understanding the error:

Can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

means Bundler 2 cannot find the version of Bundler that is specified in Gemfile.lock. If so, it would be very helpful if Bundler showed the user how to install the required bundler version, something like:

Bundler cannot find the bundler version 1.17.3 as specified in Gemfile.lock. You can install this version using:

gem install bundler --version 1.17.3

Alternatively, I personally would find it perfectly reasonable that whenever the user executes bundle install that Bundler would install all dependencies specified in Gemfile.lock. That includes the version of bundler itself specified under BUNDLED WITH.

Lastly it would be helpful whenever the user executes bundle update while having an older BUNDLED WITH that bundler would show a warning or notice that the BUNDLED WITH specifies an older version and thus can be updated to the latest version using bundle update --bundler. Otherwise projects will be stuck with Bundler 1.17.3 forever.

@deivid-rodriguez
Copy link
Member

@bobvanderlinden Your suggestions make sense and it's a direction we want to follow in general. Just a comment for your first suggestion. I think you might be running an old version of rubygems and if you upgrade it through gem update --system, you'll get the kind of error message you are asking for.

@bobvanderlinden
Copy link

@deivid-rodriguez Thanks. That indeed helps. It now shows:

To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.3`

@c0ze
Copy link

c0ze commented Apr 4, 2019

In our bundler 2.0.1 project, we had to fallback to 1.x because one of our dependencies.

https://github.com/abonas/kubeclient/blob/master/kubeclient.gemspec#L23

I have a feeling there will be much resistance to bundler v2, adoption will be slow, and you will have much traffic in this issue soon.

What are the main differences for v2 ? Are there any breaking changes ?

@deivid-rodriguez
Copy link
Member

@bobvanderlinden Great, glad that worked. And thanks for your suggestions!

@c0ze Bundler 2 should be essentially compatible with bundler 1. However, we decided to bump the major version anyways, because we were still shipping a few minor incompatibilities and also to signal that we were dropping support for rubies that had been supported for ages.

Anyways, the development dependencies of the gemspec you link to shouldn't be considered in principle, only runtime dependencies. Can you tell me more about your case, maybe with steps to reproduce?

@envygeeks
Copy link

@bobvanderlinden @deivid-rodriguez I should have updated my comment too. Indeed the other week I noticed that message as well and was delighted it finally gave me a nice message and obliged by installing the right version.

@c0ze
Copy link

c0ze commented Apr 4, 2019

@deivid-rodriguez

thanks for the info. Unfortunately I can not give you a link, but I was under the impression that any project bundled with v2 will require fallback v1 if one of the dependency gems required bundler v1 in the gemspec. However I can not reproduce this atm, so consider my message as a false warning.

I will check our project again. thanks !

@deivid-rodriguez
Copy link
Member

No problem @c0ze, just let me know if you manage to reproduce again. To sum up, unless there's some other issue (which could be), your dependencies should only force you to stay on bundler 1 if they specify bundler 1 as a runtime dependency.

@fused2explode
Copy link

Download the latest metasploit framework from GitHub if you want it reproduced. You need to delete the gemfile.lock to update bundler before the app will initialize its postgresql database

@indirect
Copy link
Member

@fused2explode please provide a script to reproduce the issue if you'd like us to investigate. Thanks!

@colby-swandale
Copy link
Member

I'm closing this. If anyone is still having issues, please open a new issue with the details of your problem.

@ohboyd
Copy link

ohboyd commented Jul 13, 2019

Is there any way to solve this without deleting Gemfile.lock?

Rather than deleting the whole Gemfile.lock file, you can just delete the BUNDLED WITH section of that file;

BUNDLED WITH
   1.17.1

Deleting the "BUNDLED WITH" section in my gemfile.lock solved another problem that I've been having for more than a day, so thanks for your response @olliebennett. I'm mentioning this here in case someone else is getting the error that I was.

remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     Activating bundler (2.0.1) failed:
remote:  !     Could not find 'bundler' (2.0.1) required by your /tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/Gemfile.lock.
remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
remote:  !     To install the missing version, run `gem install bundler:2.0.1`
remote:  !     Checked in 'GEM_PATH=/tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/vendor/bundle/ruby/2.6.0', execute `gem env` for more information
remote:  !     
remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:  !
remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)

I'm using ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] and Bundler version 2.0.1 (2019-01-04 commit d7ad219). I couldn't deploy to heroku to save my life, and deleting that worked when nothing else did.

@reireynoso
Copy link

Is there any way to solve this without deleting Gemfile.lock?

Rather than deleting the whole Gemfile.lock file, you can just delete the BUNDLED WITH section of that file;

BUNDLED WITH
   1.17.1

Deleting the "BUNDLED WITH" section in my gemfile.lock solved another problem that I've been having for more than a day, so thanks for your response @olliebennett. I'm mentioning this here in case someone else is getting the error that I was.

remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     Activating bundler (2.0.1) failed:
remote:  !     Could not find 'bundler' (2.0.1) required by your /tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/Gemfile.lock.
remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
remote:  !     To install the missing version, run `gem install bundler:2.0.1`
remote:  !     Checked in 'GEM_PATH=/tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/vendor/bundle/ruby/2.6.0', execute `gem env` for more information
remote:  !     
remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:  !
remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)

I'm using ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] and Bundler version 2.0.1 (2019-01-04 commit d7ad219). I couldn't deploy to heroku to save my life, and deleting that worked when nothing else did.

@ohboyd I am trying to deploy my rails api and I am getting the same exact error you had. I tried removing bundled with from my gemfile.lock file but it still returns the same error. I'm just curious, did you attempt anything else?

@ohboyd
Copy link

ohboyd commented Jul 14, 2019

@reireynoso Hey I tried a TON of other things first. Are you getting the correct versions when you run all those commands that the error message above wants you to try? I had an issue with the correct versions initially and I'm using rbenv, so I had to do some stuff in Xcode preferences to get the proper version there. If that's not something you're struggling with, I also had to use RAILS_ENV=production bundle exec rake assets:precompile to make my assets precompile locally. That wasn't working properly, initially, which led to me having to brew upgrade yarn. I realize that's all over the place, but I only say so much in case any of that rings a bell, and not because it's the direct solution. Is your repo public, or could you give me other information?

@reireynoso
Copy link

@ohboyd Hey yeah i made a rookie mistake. I updated the versions on ruby and bundler but I wasn't committing it, so every time I pushed, it was reading the older versions. But in the end I didn't need to change the gemfile.lock. I just installed the latest version of ruby (2.6.3) and bundler (2.0.2).

@nuhkoca
Copy link

nuhkoca commented Oct 28, 2019

Hey folks,

I just run below command and it works like a charm. No need to touch Gemfile.lock

bundle exec fastlane update_plugins

@ziishaned
Copy link

bundle update --bundler does not do the trick there?

Running this command fixed the issue for me

feliperenan added a commit to heartcombo/simple_form that referenced this issue Dec 24, 2019
```
4: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
  3: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
  2: from /home/travis/.rvm/rubies/ruby-2.6.3/bin/bundle:23:in `<main>'
  1: from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:294:in `activate_bin_path'
/home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:275:in `find_spec_for_exe':
  Could not find 'bundler' (1.17.3) required by your /home/travis/build/plataformatec/simple_form/Gemfile.lock.
    (Gem::GemNotFoundException)
```

Ref: rubygems/bundler#6882 (comment)
feliperenan added a commit to heartcombo/simple_form that referenced this issue Dec 24, 2019
This commit is supposed to fix the following error on Travis:

```
4: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
  3: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
  2: from /home/travis/.rvm/rubies/ruby-2.6.3/bin/bundle:23:in `<main>'
  1: from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:294:in `activate_bin_path'
/home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:275:in `find_spec_for_exe':
  Could not find 'bundler' (1.17.3) required by your /home/travis/build/plataformatec/simple_form/Gemfile.lock.
    (Gem::GemNotFoundException)
```

Ref: rubygems/bundler#6882 (comment)
feliperenan added a commit to heartcombo/simple_form that referenced this issue Dec 25, 2019
This commit is supposed to fix the following error on Travis:

```
4: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
  3: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
  2: from /home/travis/.rvm/rubies/ruby-2.6.3/bin/bundle:23:in `<main>'
  1: from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:294:in `activate_bin_path'
/home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:275:in `find_spec_for_exe':
  Could not find 'bundler' (1.17.3) required by your /home/travis/build/plataformatec/simple_form/Gemfile.lock.
    (Gem::GemNotFoundException)
```

Ref: rubygems/bundler#6882 (comment)
feliperenan added a commit to heartcombo/simple_form that referenced this issue Dec 25, 2019
This commit is supposed to fix the following error on Travis:

```
4: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
  3: from /home/travis/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
  2: from /home/travis/.rvm/rubies/ruby-2.6.3/bin/bundle:23:in `<main>'
  1: from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:294:in `activate_bin_path'
/home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:275:in `find_spec_for_exe':
  Could not find 'bundler' (1.17.3) required by your /home/travis/build/plataformatec/simple_form/Gemfile.lock.
    (Gem::GemNotFoundException)
```

Ref: rubygems/bundler#6882 (comment)

Also, the CI can no longer build for jruby 9.1.17.0 due this error:

```
NoMethodError: undefined method `[]' for nil:NilClass
  /home/travis/.rvm/gems/jruby-9.1.17.0/gems/bundler-2.1.2/lib/bundler/source/git/git_proxy.rb:90:in `version'
  /home/travis/.rvm/gems/jruby-9.1.17.0/gems/bundler-2.1.2/lib/bundler/source/git/git_proxy.rb:147:in `block in copy_to'
  org/jruby/RubyDir.java:323:in `chdir'
  /home/travis/.rvm/gems/jruby-9.1.17.0/gems/bundler-2.1.2/lib/bundler/shared_helpers.rb:52:in `block in chdir'
  /home/travis/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:214:in `mon_synchronize'
```

I'm not sure what to do to fix that, maybe we could remove this from our
build and keep only the last version of jruby?

That's what this commit does 🙈.
glacials added a commit to glacials/splits-io that referenced this issue Jan 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests