Weird Gem Error

Posted by Luke Francl
on Monday, August 10

Talk about a hard problem to diagnose!

I canceled the installation of Rack 1.0 half way through because I realized I was running the wrong command (I didn’t use sudo like I wanted to).

After that, I couldn’t load rack at all, even though I could see it in my gems directory and I could load other gems there. I got a LoadError, like this:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rack'
LoadError: no such file to load -- rack
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from (irb):2

I tried downgrading Rails to the version that used Rack 0.9.1 and then I got an error saying Rails couldn’t activate Rack 0.9.1 because 1.0.0 was already active!

Finally figured it out—there was a gemspec for rack-1.0.0 in my ~/.gems directory, but no corresponding gem in the lib directory. Ugh!