2

当我rake db:migrate在 Heroku 上运行时,出现错误。我在本地运行它没有问题。

这工作正常:

C:\unaton>rake db:migrate

但是当我使用

C:\unaton>heroku rake db:migrate

然后我收到以下错误。

(in /app)
rake aborted!
uninitialized constant Rake::DSL
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:Ta
skLib>'
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:R
ake>'
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (req
uired)>'
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/rdoctask.rb:20:in `<top (r
equired)>'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation.r
ake:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block
 in <top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `each'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `<top (
required)>'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214:in
 `initialize_tasks'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139:in
 `load_tasks'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:in
`method_missing'
/app/Rakefile:7:in `<top (required)>'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/ruby1.9.2/bin/rake:31:in `<main>'

我该如何解决这个问题?

4

2 回答 2

7

升级到 rails 3.0.9 或将其添加到 Gemfile

宝石“耙子”,“0.8.7”

于 2011-06-16T15:24:57.460 回答
0

来自http://softwaregravy.com/rake-not-backwards-compatible/

这是错误:

耙中止!未初始化常量 Rake::DSL /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in const_missing' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.1/lib/rake/tasklib.rb:8:in ' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.1 /lib/rake/tasklib.rb:6:in `'

在您的 Gemfile 中将 rake 固定为 0.8.7

宝石“耙子”,“0.8.7”

请注意,您可能已经锁定到 0.9.X,因此您需要执行以下操作:

捆绑更新 rake

于 2011-07-08T21:32:58.600 回答