`
yiyanwan77
  • 浏览: 187257 次
  • 性别: Icon_minigender_1
  • 来自: 威海
社区版块
存档分类
最新评论

rails rake problems: uninitialized constant Rake::DSL

    博客分类:
  • ROR
阅读更多

原来安装railsInstaler,里面ruby版本为1.8.7,rake版本为0.8.7,rails为3.0.6,一切正常

 

之后升级环境到ruby1.9.2-p180,创建完工程,运行bundle install命令,自动将rake升级到0.9.0,运行创建数据库命令:rake db:create --tace 出错

______________________________________________________________________

D:\mylog>rake db:create --trace

(in D:/mylog)

rake aborted!

uninitialized constant Rake::DSL

C:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'

D:/mylog/Rakefile:9:in `<class:Application>'

D:/mylog/Rakefile:8:in `<module:Mylog>'

D:/mylog/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>'

___________________________________________________________________________

google了各种说法后,确定是rake 0.9.0的问题,基本有两种解决方案,但都不好使:

 __________________________________________________________________________

方法一:回退到rake0.8.7

在gemFile中加入:gem 'rake', '0.8.7'

然后运行:bundle update rake

提示using rake 0.8.7

命令正常了,但是创建数据库失败[数据库创建成功,但中途异常终止]

_____________________________________________________________________________

方法二:在rakeFild中添加如下代码:

module ::YourApplicationName
  class Application
    include Rake::DSL
  end
end

module ::RakeFileUtils
  extend Rake::FileUtilsExt
end
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics