我试着bundle exec rake db:create:all
我发现我有两个版本的 rake gem:
rake (10.1.0, 0.9.6)
Author: Jim Weirich
Homepage: http://rake.rubyforge.org
License: MIT
Installed at (10.1.0): /Users/david/.rvm/gems/ruby-2.0.0-p247@global
(0.9.6, default): /Users/david/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0
我认为宝石的两个不同位置可能存在问题;10.1 在@global,而 0.9.6 不在。我认为解决方案可能就在这里,因为......
跟踪首先查看 0.9.6 中的目录,然后查看 10.1 中的最后两行:
dn0a158988:portfolio davidngo$ bundle exec rake db:create:all --trace
rake aborted!
cannot load such file -- /Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/boot
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `<top (required)>'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `<top (required)>'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:70:in `run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `load'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `<main>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
- 我在我的 Gemfile 中指定
`gem 'rake', '0.9.6'
- 我跑去
bundle update
更新 Gemlock 文件
提前感谢您 - 任何帮助将不胜感激!
想法:我打算尝试卸载 10.1 版本的 rake,看看它是否可以工作。