Ruby on Rails: Rack 1.0.0 not ~> Rack 1.0.1 Caused by Stranded Rack Gem
Feb
The error message
/public/../config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError) from /public/../config/../vendor/rails/railties/lib/initializer.rb:134:in `process' from /public/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send' from /public/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run' from /public/../config/environment.rb:9 from /public/dispatch.fcgi:21:in `require' from /public/dispatch.fcgi:21
Old news?
If you have this problem, odds are you’ve been pouring over Google and you’re here because you have not resolved (comment #7) your problem. I’ve seen the “solutions” out there and they all claim: “Remove rack 1.1.0. Install rack 1.0.1”. I tried it and it didn’t solve my problem. The trick is, my error message was different. Also, most others are having trouble with WEBrick. I was having issues with lighttpd. I tried everything: commenting out line 23 in action_controller.rb (bad idea, by the way) in my vendor/rails/actionpack/action_controller/lib/action_controller.rb. Added gem ‘rack’, ‘= 1.0.1’ in dispatch.fcgi (moved the error message, but didn’t fix it).
The solution
Manually remove the residual rack-1.0.0 installation.
I will assume you’ve already tried:
sudo gem uninstall rack
Do be careful!
sudo rm -rf /opt/local/lib/ruby/gems/1.8/gems/rack-1.0.0 sudo gem install rack --version "= 1.0.1"
What happened?
The problem was that rack-1.0.0 wasn’t uninstalled completely. RubyGems thought it was, but it was still being included in the code. Why? Because it existed here:
/opt/local/lib/ruby/gems/1.8/gems/rack-1.0.0
wojno% gem list | rack rack (1.0.1)
I don’t know how it was stranded there. I only use gem to add/remove gems, yet somehow it was left there to rot my brain while I’m under deadline.
Fun!
Keep in mind, I use MacPorts and keep it fairly updated.