0
votes

Started learning ruby on rails today, after spending the half day fixing the other errors, I am stuck at the following: When I enter the following command in the terminal: " bundle exec rake db:migrate" or "rails server" it gives me the following error:

Could not find rake-0.9.2 in any of the sources Run bundle install to install missing gems.

I ran bundle install rake (Both with version number and without) and it says it has been installed to ./rake. When I run the command it gives me the same error again. No Idea how to fix this, so any help is wholeheartedly appreciated. I am using ruby 1.9.2 and rails 3.0.9 in the directory the App is located in with RVM. Thanks in advance for any help.

EDIT:

* LOCAL GEMS *

Using rake (0.9.2) Using abstract (1.0.0) Using activesupport (3.0.9) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.9) Using erubis (2.6.6) Using rack (1.2.3) Using rack-mount (0.6.14) Using rack-test (0.5.7) Using tzinfo (0.3.29) Using actionpack (3.0.9) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.19) Using actionmailer (3.0.9) Using arel (2.0.10) Using activerecord (3.0.9) Using activeresource (3.0.9) Using bundler (1.0.15) Using rdoc (3.8) Using thor (0.14.6) Using railties (3.0.9) Using rails (3.0.9) Using sqlite3-ruby (1.2.5)

EDIT2: This has been fixed: 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.2.]

2
show: which bundle, which rake, which ruby - fl00r
it supposed to be the same problem as here stackoverflow.com/questions/6658090/… - Anatoly
Running the command which rake: /Users/jaymcquire/.rvm/gems/ruby-1.9.2-p290/bin/rake Running the command which ruby: /Users/jaymcquire/.rvm/rubies/ruby-1.9.2-p290/bin/ruby Running which bundle: /Users/jaymcquire/.rvm/gems/ruby-1.9.2-p290/bin/bundle - Jay Mcquire
source 'rubygems.org' gem 'rails', '3.0.9' gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' gem 'rake', '0.9.2' - Jay Mcquire
You don't need to add dependency for rake explicitly in Gemfile, it comes with rails anyway. Can you remove rake dependency for rake and try again? - leenasn

2 Answers

1
votes

First, you should unlock the Gemfile

[root@localhost ~]#cd yourapplication
[root@localhost yourapplication]#bundle unlock

Then, edit your Gemfile, add gem rake

[root@localhost yourapplication]#vi Gemfile
+ gem 'rake', '0.9.2'

Then, update bundle

[root@localhost yourapplication]#bundle update

0
votes

I guess you tried already gem install rake but it should come with rails anyway.

Well, what fl00r said in comments above, or show us the output of gem list --local