Ruby rake loaderror - bundle exec rake not working
Asked Answered
S

2

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.

Sadirah answered 17/8, 2015 at 14:50 Comment(6)
The latter command you mention is bundle exec rake:db migrate. Do you mean bundle exec rake db:migrate or is that an issue?Abroach
yes, that's what i meant. sorryTerrilynterrine
@Ol'Reliable Did you run bundle install?Ramadan
yes, and that was successfulTerrilynterrine
Does bundle exec gem list show Rake is installed ?Jodyjoe
@PaulSturgess Yup! rake (10.4.2)Terrilynterrine
B
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.

Bulahbulawayo answered 17/8, 2015 at 16:10 Comment(6)
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/rakeBulahbulawayo
There is a similar issue here: github.com/sstephenson/rbenv/issues/495 You should try upgrading your Rubygems or bundler as well. See if that fixes the issue.Bulahbulawayo
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.Terrilynterrine
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.Terrilynterrine
UPDATE: after doing bundle install rake I have everything up to and including the default directory.Terrilynterrine
Let us continue this discussion in chat.Bulahbulawayo
P
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.

Preexist answered 1/4, 2021 at 11:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.