Rails:在生产模式下迁移时出现问题

时间:2012-01-13 21:09:04

标签: ruby-on-rails ruby ruby-on-rails-3 deployment migration

我正在使用Rails 3.1.0,我正在尝试部署我的应用程序。我正在使用Capistrano宝石,它可以工作,但不适用于迁移。当它运行rake db:migrate RAILS_ENV=production命令时,它输出以下内容:

(in /srv/www/MY_APPLICATION/releases/20120113203834)
rake aborted!
uninitialized constant Rake::DSL
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/testing.rake:2:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/railtie.rb:12:in `block in <class:TestUnitRailtie>'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `block in load_tasks'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `load_tasks'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:396:in `block in load_tasks'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application/railties.rb:8:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application/railties.rb:8:in `all'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:396:in `load_tasks'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:103:in `load_tasks'
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
/srv/www/MY_APPLICATION/releases/20120113203834/Rakefile:7:in `<top (required)>'
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `<main>'

我还尝试直接在shell中运行rake任务,但它不起作用。我得到了同样的错误。

有什么问题?我该如何解决?


此外,我的远程计算机正在运行 Ubuntu 10.04 ,如果我尾部记录(tail -f /var/log/apache2/error.log),每次我尝试浏览应用程序的网页时,都会得到以下输出: / p>

cache: [GET /start] miss

通过运行cap deploy:migrations命令(与Capistrano宝石相关),我注意到以下内容:

...

  * executing `deploy:migrate'
  * executing "cd /srv/www/MY_APPLICATION/releases/20120113220043 && rake RAILS_ENV=production  db:migrate"
    servers: ["96.126.127.122"]
    [96.126.127.122] executing command
*** [err :: 96.126.127.122] /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:9: warning: already initialized constant RUBY
*** [err :: 96.126.127.122] /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:86: warning: already initialized constant LN_SUPPORTED
 ** [out :: 96.126.127.122] (in /srv/www/MY_APPLICATION/releases/20120113220043)
*** [err :: 96.126.127.122] rake aborted!

...

0 个答案:

没有答案