rake db:miagrate aborted abnormal:rake aborted!未初始化的常量Rake :: DSL

时间:2011-11-16 05:19:21

标签: ruby-on-rails rake dbmigrate

有人可以帮助我吗? 我搜索了同样的问题,但我仍然无法找到解决方案。 我使用“捆绑更新”“捆绑安装”成功运行但是当运行“rake db:migrate”时,我遇到了以下问题......

rake aborted!
uninitialized constant Rake::DSL
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<clas
s:TaskLib>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<modu
le:Rake>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top
(required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdoc-3.11/lib/rdoc/task.rb:37:in `<top (requ
ired)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation
.rake:2:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `blo
ck in <top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `each
'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `<top
 (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:
in `initialize_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:139:
in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:i
n `method_missing'
C:/F/desktop/Projects/recle/recle/rails/eway/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>'

1 个答案:

答案 0 :(得分:1)

将它放在你的Rakefile上面,需要'rake':

require 'rake/dsl_definition'

如果上述解决方案不起作用,

在你的gemfile中写这个rake

gem "rake", "0.8.7"

然后转到命令提示符并写入。

gem uninstall rake

这将卸载现有的rake gem。

然后在项目文件夹中键入bundle update,它将再次安装rake 9.8.7。

享受铁路:)。