问题
I'm on Mac OS X 10.6 Snow Leopard. I just updated my Ruby stuff using:
sudo gem update
Unfortunately, it broke everything. When I try to run a simple command in my website directory, like:
rails generate model User
It failed, with this error:
Could not find gem 'rails (= 3.0.3, runtime)' in any of the gem sources listed in your Gemfile. Try running
bundle install
.
So I tried running bundle install rails
. It succeeded! So I tried running rails
. It failed. So I tried getting the Rails version by entering:
rails -v
Which failed with this error:
Could not find rake-0.8.7 in any of the sources
Try runningbundle install
.
But not only did it fail, it also created an empty folder rails/ruby/1.8
in my website directory.
This is a complete disaster for me as I am just a beginner in Ruby and Ruby on Rails, and even in the Terminal. Any help would be MUCH appreciated. Thanks.
回答1:
all this stems from having a version of rack that is not exactly 1.0.1 iirc.
Even if you have a version ahead of it, your whole setup will not install properly.
Uninstall all versions of rack and make sure you only have that one.
As Justin said in your comments, now get rvm. Run, don't walk.
来源:https://stackoverflow.com/questions/4536380/could-not-find-gem-rails-headaches