微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – rake db:migrate失败并显示错误:“rake aborted!未定义的方法`弃用’为#“

花了一些时间没有在轨道上编程,现在我“回来了”事情出了问题.
我安装了 ruby 1.9.2-p0并坚持使用rails 3.0.1.Updated所有gems和bundle运行成功.修复了一个新的rails应用程序并创建了一个迁移但是在运行时

rake db:migrate

我明白了:

rake aborted!
undefined method `deprecate' for #<Rake::Application:0x1e0c6c0>
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb:4:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks/documentation.rake:1:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:15:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:15:in `block in <top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:6:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:6:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:213:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:213:in `initialize_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:139:in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:77:in `method_missing'
D:/sites/hebrew_learning/Rakefile:7:in `<top (required)>'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
C:/Ruby192/bin/rake:31:in `<main>'

我确实迷失在这里,所以任何小费都会受到高度赞赏

编辑:

跑完之后

bundle exec rake

我明白了:

WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
WARNING: Global access to Rake DSL methods is deprecated.  Please include
...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method HebrewLearning::Application#task called at C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:214:in `initialize_tasks'
You have 1 pending migrations:
20111104081644 createusers
Run "rake db:migrate" to update your database then try again.

解决方法

如果您使用的是rails 3.0.1,可以在gemfile中尝试:

gem 'rake','0.8.7'

或者尝试在gemfile中迁移到3.0.9更改.

之后运行:

bundle update

再见

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐