Rake提示uninitialized constant Rake::DSL解决办法

    1.rake aborted!   
    2.uninitialized constant Rake::DSL   
    3./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'   
    4./usr/local/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'   
    5./usr/local/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'   
    6./usr/local/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'   
    7./usr/local/ruby/lib/ruby/gems/1.9.1/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `require'   
    8./usr/local/ruby/lib/ruby/gems/1.9.1/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `<top (required)>'   
    9./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.rake:2:in `require'   
    10./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.rake:2:in `<top (required)>'   
    11./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `load'   
    12./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `block in <top (required)>'   
    13./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `each'   
    14./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `<top (required)>'   
    15./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in `require'   
    16./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in `initialize_tasks'   
    17./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:139:in `load_tasks'   
    18./usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'   
    19./usr/local/sharephoto/Rakefile:7:in `<top (required)>'   
    20./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2373:in `load'   
    21./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'   
    22./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'   
    23./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'   
    24./usr/local/ruby/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'   
    25./usr/local/ruby/lib/ruby/1.9.1/rake.rb:1991:in `run'   
    26./usr/local/ruby/bin/rake:31:in `<main>' 

因为我用的是rvm   如ruby1.9.2-p290  rails是3.2.1,在执行rake:db create的时候报错了,解决办法:
在 config/application.rb文件的上部加上:
require 'rake/dsl_definition'

你可能感兴趣的:(Const)