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!


Leave a response

  1. JoachimAugust 10, 2009 @ 11:05 AM

    These are the ‘little things’ that really steal time ! Thank’s for sharing, once I get an error like that, I’ll have a look at the gemspecs.

  2. Brooke KuhlmannAugust 30, 2009 @ 08:50 AM

    I know the feeling. In my case, I got an invalid gem format issue due to the fact that I installed the gem incorrectly and ended up with a blank gem file that was a little confusing to fix at first.