‘report_activate_error’: RubyGem version error

So from time to time I will post small things to my blog that I just want to keep track of or remember how I did something. This is one of those post. I should prefix this post to anyone who happens to come across it and read it, I am by no means a "Rails Developer" and as a matter of fact, I ran into this problem working through a "How to" books.

The issue

I am running OSX 10.6.2 and although I had Ruby on Rails working on it at one time, some how, some where it broke. Now there is nothing more frustrating to a n00b who is trying to work through a tutorial on how to learn a new programming language and not being able to get past the first chapter because something about the base install of the programming language that you don't know anything about and you're trying to learn, wont work.

The Actual Error

When I try to create my first controller this is what happens

  1. ruby script/generate controller main welcome

And this is what the system kicked out to me
  1. /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)</p>
  2. <p>from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'<br />
  3. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'<br />
  4. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'<br />
  5. from /Users/eric/Dropbox/Code/Rails/r4music1/config/environment.rb:9<br />
  6. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
  7. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br />
  8. from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1<br />
  9. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
  10. from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br />
  11. from script/generate:3

Naturally, the first thing I do is start hitting Google and start clicking on links. A lot of similar issues with a wide variety of solutions. From just doing a simple 'sudo gem update', to making sure rake is installed, to making sure you have the correct rake version installed. None of which worked for me. Finally, I stumbled onto Wojno' Site and following the steps in his post I manage to resolve my problem.

The Fix
If you didn't want to click on Wonjno's link here are the steps that fixed my problem. Had to change a couple of things because my install paths were a little different since I was running a different OS.
We begin by uninstalling the problem package

  1. sudo gem uninstall rack

When prompted, make sure you remove all versions of the rack packages. Now this is one place where my experience differed a little. I ended up getting prompted to uninstall rails itself. I'm a brave soul, that didn't scare me, so yeah I uninstalled it.
Here is what that looked like
  1. <br />
  2. sudo gem uninstall rack<br />
  3. Remove executables: rackup in addition to the gem? [Yn] &nbsp;Y<br />
  4. Removing rackup<br />
  5. You have requested to uninstall the gem: rack-1.0.0<br />
  6. actionpack-2.3.3 depends on [rack (~> 1.0.0)]<br />
  7. actionpack-2.3.5 depends on [rack (~> 1.0.0)]<br />
  8. If you remove this gems, one or more dependencies will not be met.<br />
  9. Continue with Uninstall? [Yn] &nbsp;Y<br />

OK, that was a little scary but we will fix it.
I did manually remove the directory for the older version of rack
  1. <br />
  2. sudo rm -rf /Library/Ruby/Gems/1.8/gems/rack-1.0.1/<br />
  3. </bash><br />
  4. Now we reinstall things. Don't forget we need to reinstall the rails itself<br />
  5. <code lang="rails"><br />
  6. sudo gem install -v=2.3.5 rails<br />
  7. sudo gem install rack<br />

After that, life was good, at least for me. If you found this article and actually read it in hopes that it helped fix your issue, well then I hope you had some success as well.

Posted via web from shocm