我收到错误
rake db:migrate --trace
rake aborted!
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
/Users/iang/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/Users/iang/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/Users/iang/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/Users/iang/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `require'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `rescue in require'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:122:in `require'
/Users/iang/code/Projects/work/startco/config/boot.rb:4:in `<top (required)>'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/iang/code/Projects/work/startco/config/application.rb:1:in `<top (required)>'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/iang/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
/Users/iang/code/Projects/work/startco/Rakefile:4:in `<top (required)>'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:637:in `raw_load_rakefile'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:93:in `load_rakefile'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:77:in `block in run'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/bin/rake:23:in `load'
/Users/iang/.rvm/gems/ruby-2.0.0-p247/bin/rake:23:in `<main>'
使用了捆绑包并没有解决问题...有任何想法可以帮助解决这个问题吗?
答案 0 :(得分:30)
我遇到了同样的错误。正在运行bundle update
解决了它。
更新:正如TuK bundle update rake
所建议的那样。
答案 1 :(得分:14)
您想使用bundle exec
:
bundle exec rake db:migrate
或者,如果您使用的是Rails 4 binstubs:
./bin/rake db:migrate
答案 2 :(得分:4)
我在使用capistrano部署到生产时收到此错误消息。为了解决这个问题,我在生产服务器上执行了以下操作:
gem update rake
答案 3 :(得分:0)
您可以运行此命令
bundle exec rake db:migrate
答案 4 :(得分:0)
bundle update rake
为我解决了这个问题。
答案 5 :(得分:0)
我遇到了同样的错误,但运行bundle update rake
对我不起作用。这answer对我有用。你必须删除你的Gemfile.lock:
rm Gemfile.lock
然后重新捆绑:
bundle install
答案 6 :(得分:0)
我得到了答案。 为什么我们收到此错误? 对于我们的操作系统的rake版本与我们项目的版本不同。 当我们设置相同时。一切都好!
light方式在我们的Gemfile中设置了相同的版本。并确保所有项目保持相同的佣金!
gem 'rake', '10.2.2' #forking error! force the version the same with our OS and all projects!!!
我希望你看到我说的话以及这个错误的真正原因。然后我们将有更多的解决方案,例如&#34;捆绑更新rake&#34;。谢谢!
答案 7 :(得分:-1)
只需按命令安装旧版本:gem install rake -v '10 .1.0'