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
ruby script/generate controller main welcome
And this is what the system kicked out to me
/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> <p>from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'<br /> from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'<br /> from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'<br /> from /Users/eric/Dropbox/Code/Rails/r4music1/config/environment.rb:9<br /> from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br /> from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br /> from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1<br /> from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br /> from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'<br /> from script/generate:3
Sidebar
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
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
<br /> sudo gem uninstall rack<br /> Remove executables: rackup in addition to the gem? [Yn] Y<br /> Removing rackup<br /> You have requested to uninstall the gem: rack-1.0.0<br /> actionpack-2.3.3 depends on [rack (~> 1.0.0)]<br /> actionpack-2.3.5 depends on [rack (~> 1.0.0)]<br /> If you remove this gems, one or more dependencies will not be met.<br /> Continue with Uninstall? [Yn] 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
<br /> sudo rm -rf /Library/Ruby/Gems/1.8/gems/rack-1.0.1/<br /> </bash><br /> Now we reinstall things. Don't forget we need to reinstall the rails itself<br /> <code lang="rails"><br /> sudo gem install -v=2.3.5 rails<br /> 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