Gem::LoadError: Could not find rubygems-bundler (>

2019-07-26 14:17发布

问题:

I'm running rvm with ruby 1.9.3. I've ran bundle install and it worked fine. But when I run bundle install --deployment I get this:

volunteer-app ➜ bundle install --deployment
Fetching gem metadata from http://rubygems.org/.......
Installing rake (0.9.2.2) 
Gem::LoadError: Could not find rubygems-bundler (>= 0) amongst []
An error occured while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.

After this is ran I look in the vendor/bundle/ruby directory and it shows 1.9.1. So it looks like bundle install --deployment isn't recognizing my gems in from rvm's default ruby version 1.9.3.

Any thoughts on what I could be missing.

Edit Here's my gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/sosl/.rvm/gems/ruby-1.9.3-p194@teer
  - RUBY EXECUTABLE: /home/sosl/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /home/sosl/.rvm/gems/ruby-1.9.3-p194@teer/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/sosl/.rvm/gems/ruby-1.9.3-p194@teer
     - /home/sosl/.rvm/gems/ruby-1.9.3-p194@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

回答1:

It's a bug in both rubygems-bundler and bundler, I have already fixed it for rubygems-bundler and a fix for bundler is waiting for merge.

Fastest way to fix is to update rubygems-bundler:

gem update rubygems-bundler

For reference here is pull request for bundler:

  • https://github.com/carlhuda/bundler/pull/1925


回答2:

I really feel for you as I just went though something simular last night. While I am certainly not an expert (I am just a student of RoR as you are) can I make some suggestions?

  1. After you use RVM to change into your RUBY version, run a "local" gem list to see what gems are installed locally. Do you have the gem installed in your local gems?
  2. Sometimes gem files get "Jumbled" and stop working altogether. Have you tried to uninstall and then reinstall the gems? The command is simple. In your console type "gem uninstall (the name and version number of the gem you wish to uninstall). It may reply that the gem you wish to uninstall has dependencies on other gems you have installed. Don't worry once you reinstall those gems the dependencies will be satisfied.
  3. I don't know if Bundler is installed automatically or not. Is it listed in your "Local" gems or in your gemfile.lock?

Best of luck in correcting this.