Rails - rake db:创建错误

发布于 2024-11-09 04:03:37 字数 2170 浏览 0 评论 0原文

我尝试运行 rake db:create 来创建 mysql 数据库,但出现错误

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

我运行 --trace 并获取信息

/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 文件

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

我重新安装了 ruby​​、rails 和 mysql,但仍然出现相同的错误 任何帮助将不胜感激。干杯

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>

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>'

This is my database.yml file

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦醒灬来后我 2024-11-16 04:03:37

您应该在 GemFile 中精确显示您的 rake 版本。

Rake 0.9 刚刚发布,但破坏了 Rails。

这是 dhh 的推文:

Rake 0.9,昨天发布,破坏了 Rails(和其他) 。当我们等待修复时,您需要在 Gemfile 中包含 gem 'rake', '0.8.7'。

尝试一下吗?

编辑:另外,如果你真的需要 Rake 0.9 而不是 Rake 0.8.7。也许这种修复对你有用。

You should precise your version of rake in your GemFile.

Rake 0.9 just got out but break Rails.

here's the tweet of 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.

Try that?

EDIT: 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文