这里是输出:
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
这是我的rake文件:
require File.expand_path('../config/application', __FILE__)
require 'rake'
include Rake::DSL
App::Application.load_tasks
甚至不确定要查看什么或从哪里开始。任何帮助表示赞赏。谢谢!
更新: Rake命令现在可以正常工作,但在运行命令之前我仍然可以使用它:
/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
答案 0 :(得分:5)
有Ruby on Rails and Rake problems: uninitialized constant Rake::DSL和uninitialized constant Rake::DSL in Ruby Gem等答案......我会先尝试一下:
# [...]
require 'rake/dsl_definition'
require 'rake'
# [...]
如果这不能完全解决问题,您可以将gem 'rake', '>=0.9.2'
放入Gemfile
,然后执行bundle update
,最后运行bundle exec rake db:migrate
。< / p>
答案 1 :(得分:0)
对我来说有用的是从我的系统中删除旧版本的rake。我跑完之后:
sudo gem uninstall rake -v 0.8.7
我不再看到错误:
/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'
`