5
votes

Soooo, I upgraded to RubyGems 1.8.1 from 1.7.2 using gem upgrade --system, then immediately ran gem pristine --all --no-extensions as recommended on Eric Hodel's blog. After getting errors when running gem commands, I googled around a bit, found some suggestions to gem uninstall the gems with the deprecation warnings, but then realized I can't, as gem uninstall just errors out--as does any other command--including just plain ol' gem.

When I run any of those commands, I get a bunch of "deprecated" warnings still, then this backtrace:

/Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:277:in `block in _resort!': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:276:in `sort!'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:276:in `_resort!'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:270:in `_all'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:402:in `each'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:477:in `map'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:477:in `find_files'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1061:in `load_plugins'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:85:in `<top (required)>'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/bin/gem:9:in `<main>'

The same thing happened when I tried this again, but upgrading from RubyGems 1.6.2, using the same update command. I tried a 3rd time, but instead used the suggestion below to do gem install rubygems-update && update_rubygems--that just resulted in a failed install, and kept me with a usable RubyGems 1.6.2.

I'd like to a) use RubyGems 1.8.x, and b) undo these changes as opposed to having to blow away my 1.9.2 install again. Any ideas? I'm running:

  • rvm 1.6.5
  • MRI 1.9.2
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
  - INSTALLATION DIRECTORY: /Users/sloveless/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/sloveless/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/sloveless/.rvm/gems/ruby-1.9.2-p180
     - /Users/sloveless/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org"]
  - REMOTE SOURCES:
     - http://rubygems.org

FWIW, there was a similar bug logged in the RubyGems bug repo just today (May 10), and I added similar info to that, here

3
What does which gem tell you?the Tin Man
/Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/bin/gemturboladen
Thank you so much for this - I had to re-install and ended up with a new version of rubygems, and everything was messed up. This helps!Jamie Penney

3 Answers

5
votes

Had this problem with gems 1.{7..8}.*.

Here's our production stack:

  • MRI 1.9.2 and JRuby 1.6.1
  • RVM 1.6.5
  • Gems 1.6.2

Stay away from upgrading gems itself, or shit may break. I know how tempting it is to use bleeding edge, but it's more like profusely hemorrhaging all over the O.R. walls.

If you must:

  • Current user only (more common): gem install rubygems-update -v 1.6.2 && update_rubygems
  • System-wide (caution): sudo gem install rubygems-update -v 1.6.2 && sudo update_rubygems

If using RVM, be sure to rvm gemset global first.

Usual caveats apply such as backup your data, gemsets, apps and don't try this in production. :)

0
votes

It's not tied to RVM, as I'm running the same version. It's not Ruby 1.9.2 either, again because I'm running the same version.

gem uninstall ... returning errors isn't normal. I've done the upgrade on several machines running RVM and 1.9.2 and gem itself continued running correctly. And, yes, I saw the deprecated warnings.

Is it possibly you ran gem update using sudo? That would probably break it since you're running under RVM, and sudo is a major no-no.

0
votes

Well... I encountered the same error as you after updating rubygems and doing gem pristine --all --no-extensions. I, on the other hand, didn't understand the major no-no about doing my gem installs and updates using sudo, so I have a whole other mess to clean up. However, this is how I got back to a working installation:

I updated rvm by doing a fresh install: http://beginrescueend.com/rvm/install/

I encountered some other permissions issues with this step due to my no-no sudo'ing ways, but got past it. I did have to open a new terminal session for the changes to work.

Then, $ rvm rubygems current as described here: http://beginrescueend.com/rubies/rubygems/

This installed version 1.6.2. So far, I seem to have a working gem command again, and my deprecation warnings are gone. Hope it helps.