耙0.9.1错误

时间:2011-06-04 16:10:58

标签: ruby-on-rails rubygems rake

我的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:in require' /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:in require' /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:in load' /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:in each' /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:in require' /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:in call' /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:in load_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:in load_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:in raw_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:in standard_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:in run' /Users/nachtmeister/.rvm/rubies/ruby-1.9.2-p136/bin/rake:35:in'

2 个答案:

答案 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。