Ruby rake loaderror - bundle exec rake 不工作 [英] Ruby rake loaderror - bundle exec rake not working
问题描述
我正在尝试运行命令 rake db:migrate
但我不断收到此错误:
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>'
尝试 bundle exec rake db:migrate
也会给我同样的错误.
Trying bundle exec rake db:migrate
also gives me the same error.
有什么办法可以解决这个问题吗?(我使用的是 Mac OS X 10.10.5)
Is there a way I can solve this issue? (I'm on Mac OS X 10.10.5)
错误中我的 [name] 的第一个字母是大写的,尽管在我的系统中是小写的.
The first letter of my [name] in the error is upper case even though in my system, it's lower case.
编辑 [部分解决]:所以我使用的是 Ruby 版本 2.2.1,我应该使用 2.1.2.虽然这并没有修复 rake
命令错误,但我试图运行 rails server
,它在更改我的 Ruby 版本后成功运行.
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.
推荐答案
如果上述评论都不适合您,那么我怀疑您可能需要更新 rake
gem.试试:
If none of the above mentioned comments worked for you, then I suspect you may need to update rake
gem. Try:
捆绑更新耙
看看是否能解决问题.如果没有,请告诉我.我会更新答案.
See if that fixes the issue. If not, let me know. I will update the answer.
这篇关于Ruby rake loaderror - bundle exec rake 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!