Ruby on rails error when running rails s

2019-05-26 22:21发布

问题:

Um quite new to rails and um getting an error when run the command rails s it says Could not find rake-0.9.2.2 in any of the sources Run bundle install to install missing gems. when I run bundle install nothing happened

my gem list has rake 0.9.2.2 what can go wrong? my ruby version is 1.9.3 Thank you in advance

回答1:

  1. Remove all the versions of Rake ==> gem uninstall rake
  2. Remove your gemfile.lock => rm Gemfile.lock
  3. Remove gem 'rake' on your gemfile
  4. Run bundle install
  5. Install Rake manually : gem install rake --version=10.0.4


回答2:

When you use command gem list, you will get a list of gem installed on your machine.

For example : rake (10.0.4, 10.0.3, 0.9.2.2)

Just see the console which gem is compatible with your application. It is already mentioned in the error log message.

Use

gem uninstall rake

Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s



回答3:

Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]