我的rake有些问题。我的gemfile看起来像这样:
gem 'rails', '3.1.0.rc1'
gem "rake", "!= 0.9.0"
尝试迁移时出现此错误:
[rake --prereqs]耙子中止了! 未初始化的常量Rake :: DSL /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2482:in
const_missing' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.1/lib/rake/tasklib.rb:8:in
' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.1/lib/rake/tasklib.rb:6:in<module:Rake>' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.1/lib/rake/tasklib.rb:3:in
' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.1/lib/rake/rdoctask.rb:20:inrequire' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.1/lib/rake/rdoctask.rb:20:in
' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks/documentation.rake:1:inrequire' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks/documentation.rake:1:in
' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks.rb:16:inload' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks.rb:16:in
阻止' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks.rb:6:ineach' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/tasks.rb:6:in
' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/application.rb:189:inrequire' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/application.rb:189:in
块中的initialize_tasks' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/railtie.rb:182:incall' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/railtie.rb:182:in
each' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/railtie.rb:182:inload_tasks' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/engine.rb:391:in
load_tasks' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/application.rb:102:inload_tasks' /Users/nachtmeister/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.0.rc1/lib/rails/railtie/configurable.rb:28:in
method_missing' / Users / nachtmeister / Dropbox / Development / Rails / craffft / Rakefile:7:in<top (required)>' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2373:in
load' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2373:inraw_load_rakefile' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2007:in
块中的load_rakefile' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2058:instandard_exception_handling' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2006:in
load_rakefile' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:1991:inrun' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/bin/rake:35:in
'
答案 0 :(得分:2)
尝试Rake 0.8.7。 Rake基本上以一种向后不兼容的变化打破了Rails。我的Gemfile有rake '0.8.7'
。
答案 1 :(得分:2)
另一种选择是使用bundle exec rake
,如果你需要0.9.1,你可以安装rake 0.8.7和0.9.1。