5

I'm trying to run the command rake db:migrate but I keep getting this error:

/Users/[name]/.rvm/gems/ruby-2.2.1/bin/rake:23:in `load': cannot load such file -- /Users/[name]/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/specifications/default/bin/rake (LoadError)
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/rake:23:in `<main>'
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

Trying bundle exec rake db:migrate also gives me the same error.

Is there a way I can solve this issue? (I'm on Mac OS X 10.10.5)

EDIT: The first letter of my [name] in the error is upper case even though in my system, it's lower case.

EDIT [PARTIALLY SOLVED]: So I was using Ruby version 2.2.1 and I was supposed to use 2.1.2. Although this did not fix the rake command error, I was trying to run rails server which successfully ran after changing my Ruby version.

Smar
  • 8,109
  • 3
  • 36
  • 48
Ol' Reliable
  • 570
  • 1
  • 8
  • 19

2 Answers2

9

If none of the above mentioned comments worked for you, then I suspect you may need to update rake gem. Try:

bundle update rake

See if that fixes the issue. If not, let me know. I will update the answer.

K M Rakibul Islam
  • 33,760
  • 12
  • 89
  • 110
  • can you check if this path really exists or not? `/Users/[name]/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/specifications/default/bin/rake` – K M Rakibul Islam Aug 17 '15 at 16:22
  • There is a similar issue here: https://github.com/sstephenson/rbenv/issues/495 You should try upgrading your `Rubygems` or `bundler` as well. See if that fixes the issue. – K M Rakibul Islam Aug 17 '15 at 16:28
  • The error log in the question is the entire log. There is nothing else. I will check if the path exists and try upgrading Rubygems and bundler now. – Ol' Reliable Aug 17 '15 at 17:06
  • My path only exists up to: `/Users/[name]/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/` .. there is no specifications directory. – Ol' Reliable Aug 17 '15 at 17:16
  • UPDATE: after doing `bundle install rake` I have everything up to and including the `default` directory. – Ol' Reliable Aug 17 '15 at 17:22
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/87184/discussion-between-k-m-rakibul-islam-and-ol-reliable). – K M Rakibul Islam Aug 17 '15 at 17:23
0

/bin/ruby_executable_hooks.rb error indicates that the error is coming from a Bundler hook. Try to delete the .bundle directory in your project root path and see if the error is gone.

Pere Joan Martorell
  • 2,608
  • 30
  • 29