Rails rake updating issue - Could not find rake-10.4.2 in any of the sources
Solution 1
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.
Solution 2
Try typing
bundle exec rake db:migrate
That will ensure that the Rake being invoked is the one you've bundled.
TomHill
Updated on June 05, 2022Comments
-
TomHill almost 2 years
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
-
TomHill over 9 yearshmmm - 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! -
Peter Goldstein over 9 yearsHave you updated OpenSSL since you installed that Ruby? Looks like an OpenSSL linking failure to me.
-
TomHill over 9 yearsMy OpenSSL is:
OpenSSL 0.9.8za 5 Jun 2014
- is that ok for executing rake? -
Peter Goldstein over 9 yearsThat's not really the question. Check this out - stackoverflow.com/questions/25492787/… . You need to rebuild your Ruby.
-
TomHill over 9 yearsThanks for the suggestion - ran
rbenv install 2.0.0-p247
- thenrake db:migrate
and again, - Could not find rake-10.4.2 in any of the sources, so triedbrew 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 -
Peter Goldstein over 9 yearsRunning
rake db:migrate
is not going to work, per my answer. You have (or had) two separate problems. Assuming you've fixed the OpenSSL problem by reinstalling (and rebuilding) Ruby, then runbundle exec rake db:migrate
. That will invoke the correct Rake. You should also probably runrbenv rehash
- github.com/sstephenson/rbenv#rbenv-rehash - to pick up the updated rake shim. -
TomHill over 9 yearsSorry peter - maybe I didn't make myself clear - I tried both
rake db:migrate
as well asbundle exec rake db:migrate
- neither of which worked... :( - but thanks anyway -
Peter Goldstein over 9 years
brew install ruby
won't do anything for the Ruby VM, since you're using rbenv. You need to rebuild the Ruby. Tryrbenv install 2.0.0-p598
, set that as your Ruby, rungem install bundler
and then do bundle. -
TomHill over 9 yearsThanks peter - I don't know what happened but it decided to start working once I installed ruby 2.1.0 via rvm - who knows whats going on - thank you for your continued assistance :)