Ошибка прекомпиляции актива: неинициализированная константа Mongo :: Logging - PullRequest
2 голосов
/ 03 апреля 2012

Я добавляю Asset Pipeline в мое приложение Rails 3.1, размещенное в Heroku, и когда я запускаю

RAILS_ENV=production bundle exec rake assets:precompile

локально, как рекомендует Heroku здесь , он прерывается с ошибкой:

рейк отменен!неинициализированная константа Mongo :: Logging

Задачи: TOP => среда

Я попытался выполнить несколько шагов, включая предложенный Heroku

config.assets.initialize_on_precompile = false

Приложение вылетает, когда яподтолкнуть его к производству, с той же ошибкой.Насколько я понимаю, он пытается использовать объекты во время компиляции, которые еще не инициализированы на данном этапе.Какой правильный способ сделать это?

[обновление] Stack Trace

ROOT /Users/bashar/rails-projects/myapp
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant Mongo::Logging
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rpm_contrib-2.1.8/lib/rpm_contrib/instrumentation/mongo.rb:14:in `block (2 levels) in <top (required)>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:49:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:49:in `block in execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:48:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:48:in `execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:15:in `block in detect!'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:13:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:13:in `detect!'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/lib/new_relic/control/instrumentation.rb:94:in `_install_instrumentation'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/lib/new_relic/control/instrumentation.rb:53:in `install_instrumentation'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/lib/new_relic/control/instance_methods.rb:77:in `init_plugin'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.3.3/lib/newrelic_rpm.rb:36:in `block in <class:Railtie>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/bashar/rails-projects/myapp/config/environment.rb:5:in `<top (required)>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:89:in `block (2 levels) in <top (required)>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:56:in `block (3 levels) in <top (required)>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/bashar/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/bashar/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => environment
rake aborted!
Command failed with status (1): [/Users/bashar/.rvm/rubies/ruby-1.9.2-p29...]
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/bashar/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/bashar/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/bashar/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile

Спасибо

1 Ответ

1 голос
/ 04 апреля 2012

Это потому, что вы используете последний rpm_contrib драгоценный камень, а не последний mongo-ruby-driver драгоценный камень.

Таким образом, вам нужно деактивировать инструментарий MongoDB для новых rrelic rpm.Либо вы можете понизить версию или rpm_contrib, либо обновить драйвер Ruby Mongo> = 1.6

...