Rails-Rake db:创建错误 [英] Rails - rake db:create error

查看:76
本文介绍了Rails-Rake db:创建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为mysql数据库运行rake db:create但出现错误

Im trying to run rake db:create for a mysql database but getting the error

$ rake db:create
rake aborted!
undefined method `task' for #<Sharebox::Application:0x0000010085a010>

我已经运行--trace并获取了信息

Ive run --trace and get the info

/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/lucasdobbins/rails_projects/sharebox/Rakefile:7:in `<top (required)>'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:61:in `block in run'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/bin/rake:19:in `load'
/Users/lucasdobbins/.rvm/gems/ruby-1.9.2-head/bin/rake:19:in `<main>'

这是我的database.yml文件

This is my database.yml file

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: sharebox_development
  pool: 5
  username: root
  password:
  host: localhost

我已经重新安装了ruby,rails和mysql,但是仍然收到相同的错误,对您的帮助将不胜感激.欢呼声

Ive reinstalled ruby, rails and mysql but still getting the same error any help would be appreciated. Cheers

推荐答案

您应在GemFile中调整rake版本.

You should precise your version of rake in your GemFile.

Rake 0.9刚出来但打破了Rails.

Rake 0.9 just got out but break Rails.

这是 dhh 的推文:

Rake 0.9,released yesterday, broke Rails (and others). While we wait for a fix, you'll want gem 'rake', '0.8.7' in your Gemfile.

尝试一下?

另外,请参见发布的 a>如果您确实需要Rake 0.9而不是Rake 0.8.7.也许这种修复方法对您有用.

Also, see that post if you REALLY need Rake 0.9 rather than Rake 0.8.7. Maybe that kind of fix would work for you.

这篇关于Rails-Rake db:创建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆