Another: uninitialized constant Rake::DSL

匿名 (未验证) 提交于 2019-12-03 10:24:21

问题:

Here' the output:

rake aborted! uninitialized constant Rake::DSL /Users/marclipovsky/Sites/sat-7/app/Rakefile:6 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `load' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2000:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in `run' /usr/bin/rake:31

And here's my rake file:

require File.expand_path('../config/application', __FILE__) require 'rake' include Rake::DSL  App::Application.load_tasks

Not even sure what to look at or where to start. Any help is appreciated. Thanks!

Update: Rake commands work now but I still get this before it runs the command itself:

/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED

回答1:

There are answers like Ruby on Rails and Rake problems: uninitialized constant Rake::DSL and uninitialized constant Rake::DSL in Ruby Gem ... I would try this first:

# [...] require 'rake/dsl_definition' require 'rake' # [...]

If that doesn't fix it completely, you may be able to put gem 'rake', '>=0.9.2' in your Gemfile, then do a bundle update, and finally run bundle exec rake db:migrate.



回答2:

What worked for me was removing older versions of rake from my system. After I ran:

sudo gem uninstall rake -v 0.8.7

I stopped seeing errors like:

/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED 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 Rake::TestTask#ruby called at /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby' 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 Object#ruby called at /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby'

`



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!