6

I'm attempting (without much success) to run rake db:migrate on a rails project, however it returns:

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

I ran bundle install and worked fine - installed rake 10.4.2, however when I ran: rake --version (for some reason you can't do rake -v ???) and it shows: rake, version 0.9.6

I ran bundle update rake and returned my list of gems and then: Your bundle is updated!

Why isn't rake updating? Is there something I'm doing wrong (I'm new to rails btw - so this is probably really simple)

Any help is really appreciated

2 Answers 2

16
+50

TL; DR: gem install rake -v '10.4.2'

So, I had this problem myself. I wanted to know why rails s would work yesterday and not today.

First I checked if I was in the correct directory, I was. Then I re-ran bundle install to make sure rake was getting installed. It was, and I was able to see it in my Gemfile.lock So I figured my gemset might be corrupt (I use RVM). rvm gemset empty then bundle install

Still, whenever I ran rails s, I got this error. bin/rails s worked, as well as bundle exec rails s. But I don't want a prefix, I want rails to work (It works in other rails projects)

Eventually I tried gem install rake and it worked! I recommend adding -v '10.4.2' to the command so that you get the correct rake version. Now when I which rake, I get the gemset for my project: "/Users/cm022291/.rvm/gems/ruby-2.2.1@project_gemset/bin/rake"

and when I run rails s the server starts successfully.

2

Try typing

bundle exec rake db:migrate

That will ensure that the Rake being invoked is the one you've bundled.

9
  • hmmm - I'm getting an error: rake aborted! LoadError: dlopen(/Users/TomHill/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method Referenced from: /Users/TomHill/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle - plus a load of other file paths? - thanks for helping!
    – TomHill
    Commented Dec 22, 2014 at 22:51
  • 1
    Have you updated OpenSSL since you installed that Ruby? Looks like an OpenSSL linking failure to me. Commented Dec 22, 2014 at 22:58
  • My OpenSSL is: OpenSSL 0.9.8za 5 Jun 2014 - is that ok for executing rake?
    – TomHill
    Commented Dec 23, 2014 at 1:27
  • That's not really the question. Check this out - stackoverflow.com/questions/25492787/… . You need to rebuild your Ruby. Commented Dec 23, 2014 at 1:37
  • Thanks for the suggestion - ran rbenv install 2.0.0-p247 - then rake db:migrate and again, - Could not find rake-10.4.2 in any of the sources, so tried brew install ruby - and again nothing. rake --version still shows 0.9.6. bundle exec rake db:migrate still shows: LoadError: dlopen - thanks so much for your help with this btw
    – TomHill
    Commented Dec 23, 2014 at 2:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.