Find_spec_for_exe ': cannot find gem bundler (> = 0.a) (Gem :: GemNotFoundException)

I used sudo bundle install , and this may be causing the problem?

Now I have:

  • gem -v 2.6.14
  • ruby -v ruby 2.3.5p376 (2017-09-14, revision 59905) [x86_64-darwin15]
  • jekyll -v 3.6.2
  • bundle -v Bundler version 1.16.0.pre.3

When trying to run bundle exec jekyll serve or just jekyll serve

I get the following error
 /Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:271:in 'find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) from /Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:299:in 'activate_bin_path' from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/bundle:23:in '<main>' from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in 'eval' from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in '<MacBooMacBook-MacBook-MacBook-Pro-MacBook-PrMacBook-MacBooMacBMaMacBMaMaMaMaMaMaMaMaMacBMaMaMaMacBMa 

Also, when accessing the folder where my cd my_path blog is cd my_path , I get the following message:

The VM used your Gemfile to select Ruby, everything is fine - Heroku does the same, you can ignore these warnings with the 'rvm rvmrc warning ignore / Library / WebServer / Documents / blog / Gemfile'. To ignore the warning for all files, run "rvm rvmrc warning ignore allGemfiles". Unknown version of ruby ​​interpreter (I don’t know how to handle it): RUBY_VERSION.

I have no idea how to solve this. I just want to create my own static blog and, frankly, have no idea about Ruby, Gem or Bundle :) So I would appreciate some ideas!

+190
ruby bundle rubygems jekyll
source share
13 answers

The problem in my case is that the Gemfile.lock file had a version of BUNDLED_WITH version 1.16.1 and 1.16.1 gem install bundler version 2.0.1 , so there was a version mismatch when searching for the correct folder.

gem install bundler -v 1.16.1 fixed this

Of course, you can also change Gemfile.lock BUNDLED_WITH from the latest bundler version and use recent software, as Sam3000 assumes

+327
source share
 gem update --system 

will update rubygems and fix the problem.

+117
source share

Update:

According to @noraj answer and @Niels Kristian comment, the next team should do the job.

 gem update --system bundle install 

I wrote this in case someone gets into a problem like mine.

gem install bundler shows that everything installs well.

 Fetching: bundler-1.16.0.gem (100%) Successfully installed bundler-1.16.0 Parsing documentation for bundler-1.16.0 Installing ri documentation for bundler-1.16.0 Done installing documentation for bundler after 7 seconds 1 gem installed 

When I typed bundle an error occurred:

 /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in 'load': cannot load such file -- /Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError) from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in '<main>' from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in 'eval' from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in '<main>' 

And in the folder /Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/ there was no bundler-1.16.0 .

I fixed it with sudo gem install bundler

+61
source share

The real answer is here if you are trying to install bundler 2.0.1 or 2.0.0 due to a bundler requiring RubyGems v3.0.0

Yesterday I released Bundler 2.0, which made a number of major changes. One of these changes was setting up the Bundler to use RubyGems v3.0.0. After the release of the release, it became clear that many of our users are experiencing problems with Bundler 2, requiring a truly new version of RubyGems.

We carefully listen to user reviews and decided to reduce the requirement of RubyGems to version 2.5.0 at least. We have released a new version of Bundler, v2.0.1, which governs this requirement.

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

+31
source share

This fixed this:

  1. Delete Gemfile.lock rm Gemfile.lock
  2. run bundle install again
+25
source share

The reason is that you are using the current ruby ​​environment, you received a different version of bundler with the version in Gemfile.lock .

  • The safe way, install the package with the same version in Gemfile.lock , it will not break anything if something incredible happens.
  • The hard way, just uninstall Gemfile.lock and run Gemfile.lock bundle install .
+18
source share

If you changed the ruby ​​version used with rvm use , delete Gemfile.lock and try again.

+12
source share

Open Gemfile.lock, which is located in the root of your application folder. Scroll to the end of the file and see the version of the package you are using. Then make sure that you have installed the version of the package you are using:

 gem install bundler -v x.xx.xx 

Or - uninstall Gemfile.lock and the kit if you have a later version of the kit.

The choice is yours, my friend.

+4
source share

Today I had the same problem. I rvm this problem by deleting any PATH in .bashrc for the older rvm .

0
source share

My problem was that I used RVM and activated the wrong version of Ruby ...

I hope this helps at least one person

0
source share

Nick Cove to the point. run gem install bundler .

0
source share

I had to do rake clean --force . Then gem install rake and so on.

-2
source share

I lowered the ruby ​​from 2.5.x to 2.4.x in my particular case.

-2
source share

All Articles