错误 - :未初始化的恒定Airbrake(NameError)

时间:2012-10-16 03:16:46

标签: ruby-on-rails-3 deployment production-environment airbrake

我正在开发一个rails 3.2.8项目,我刚刚安装了airbrake gem来跟踪错误,在开发中我做了airbrake安装步骤,然后当我用capistrano进行部署时,我得到了以下错误在独角兽生产日志中:

E, [2012-10-16T03:02:51.588084 #3645] ERROR -- : reaped #<Process::Status: pid 3846 exit 1> worker=3
I, [2012-10-16T03:02:51.588434 #3645]  INFO -- : worker=3 spawning...
I, [2012-10-16T03:02:51.708539 #3858]  INFO -- : worker=3 spawned pid=3858
I, [2012-10-16T03:02:51.708986 #3858]  INFO -- : Refreshing Gem list
E, [2012-10-16T03:02:52.793217 #3849] ERROR -- : uninitialized constant Airbrake (NameError)
/home/ubuntu/apps/nimrod/releases/20121011033552/config/initializers/airbrake.rb:1:in `<top (required)>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in `block in <class:Engine>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/ubuntu/apps/nimrod/releases/20121011033552/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require'
config.ru:4:in `block in <main>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn.rb:44:in `eval'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn.rb:44:in `block in builder'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:696:in `call'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:696:in `build_app!'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:569:in `init_worker_process'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:589:in `worker_loop'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:487:in `spawn_missing_workers'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:498:in `maintain_worker_count'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:272:in `join'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/bin/unicorn:19:in `load'
/home/ubuntu/apps/nimrod/shared/bundle/ruby/1.9.1/bin/unicorn:19:in `<main>'

我注意到airbrake gem安装在shared / bundle / ruby​​ / 1.9.1 / gem中与所有其他宝石一起。

在制作中,我正在运行一个Ubuntu 12.04 x64,独角兽用nginx和ruby 1.9.3-p194运行,带有这个宝石

Using airbrake (3.1.4) 
Using capistrano (2.12.0)    
Using bundler (1.1.4) 
Using rails (3.2.8) 
Using unicorn (4.3.1) 

还试图阻止nginx,unicorn然后再次启动它们,但它没有用

我希望有人可以帮助我

3 个答案:

答案 0 :(得分:1)

更新我的包后发生了类似的错误。

您的airbrake初始化程序(config / initializers / airbrake.rb或config / initializers / errbit.rb)似乎需要rake_handler:

require 'airbrake/rake_handler'

答案 1 :(得分:0)

与上面的knagode类似。我需要添加rake处理程序。

require 'airbrake/rake_handler'

我还需要再次停止并启动服务器。

cap <env> deploy:stop
cap <env> deploy:start

重启功能似乎没有发现它。

我的筹码:

  • Nginx的
  • 独角兽
  • Rails 4
  • Sidekiq
  • Redis的
  • 的Postgres

答案 2 :(得分:0)

以这种方式重新启动服务器对我有帮助:

---
title: "smp"
author: "XXX YYY"
date: "October 9, 2019"
output:
  pdf_document: default
header-includes: \usepackage{setspace}\doublespacing
---