6

我在理解错误日志时遇到问题。我正在使用 Active Admin,在我的本地服务器上一切正常,但是当我推送到 Heroku 时,我无法登录或使用 Active admin。我对问题是什么感到有点困惑。我妻子的前端工作,但是当我第一次尝试登录时,我得到了这个错误。

我跑了

 heroku run rake db:migrate

应用程序.rb

   config.assets.initialize_on_precompile = false

路线.rb

 break if ARGV.join.include? 'assets:precompile'

Heroku 日志

2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:153:in `respond'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:146:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/app/controllers/devise/sessions_controller.rb:9:in `new'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:436:in `_run__2148348972389484395__process_action__581573497384646045__callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:17:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/rai
lties/controller_runtime.rb:18:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:121:in `process'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/rendering.rb:45:in `process'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:203:in `dispatch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:246:in `block in action'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:36:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/mapper.rb:40:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `each'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:600:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/sass-3.1.18/lib/sass/plugin/rack.rb:54:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:35:in `block in call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:34:in `catch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:34:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/head.rb:14:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/flash.rb:242:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/cookies.rb:338:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/dragonfly-0.9.12/lib/dragonfly/cookie_monster.rb:9:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/query_cache.rb:64:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `_run__2527400173333692808__call__757062616006589650__callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:26:in `call_app'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:16:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/dragonfly-0.9.12/lib/dragonfly/middleware.rb:13:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:479:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:220:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/log_tailer.rb:14:in `call'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:80:in `block in pre_process'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
2012-06-01T06:11:53+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
2012-06-01T06:11:53+00:00 app[web.1]:   script/rails:6:in `require'
2012-06-01T06:11:53+00:00 app[web.1]:   script/rails:6:in `<main>'
2012-06-01T06:11:53+00:00 app[web.1]: 
2012-06-01T06:11:53+00:00 app[web.1]: 
2012-06-01T06:11:53+00:00 app[web.1]: Processing by ActiveAdmin::Devise::SessionsController#new as HTML
2012-06-01T06:11:53+00:00 app[web.1]:   Rendered vendor/bundle/ruby/1.9.1/bundler/gems/active_admin-3020d04d5c8f/app/views/active_admin/devise/shared/_links.erb (1.1ms)
2012-06-01T06:11:53+00:00 app[web.1]:   Rendered vendor/bundle/ruby/1.9.1/bundler/gems/active_admin-3020d04d5c8f/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (292.9ms)
2012-06-01T06:11:53+00:00 app[web.1]: Completed 500 Internal Server Error in 456ms

配置/env/development.rb

 # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true

宝石文件

source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development do
        gem 'pg'
        #gem 'sqlite3'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'pg'
  gem 'thin'
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platform => :ruby
  gem 'uglifier', '>= 1.0.3'
  gem 'chosen-rails'
end

gem 'jquery-rails'
gem "activeadmin", :git => "git://github.com/gregbell/active_admin.git"
gem "zurb-foundation"
gem "friendly_id", "~> 4.0.1"
gem 'simple_form'
gem 'rack-cache', :require => 'rack/cache'
gem 'dragonfly', '~>0.9.12'
gem "fog"
gem 'rmagick'
gem 'tinymce-rails'

更新:

我在我现在正在使用的 gemfile 上

ruby '1.9.3'
gem  'rails', '3.2.5'

但错误日志有

vendor/bundle/ruby/1.9.1/gems/

heroku 不应该为我选择 Ruby 1.9.3 吗?

4

5 回答 5

4

试试这两件事:

config/environments/production.rb config.assets.compile = true 

在你的 gem 文件中

gem "activeadmin", :git => "git://github.com/gregbell/active_admin.git"

bundle install

推到heroku,看看它有效

于 2012-06-02T19:14:01.053 回答
2

移出资产组,捆绑并重试gem 'sass-rails', '~> 3.2.3'gem 'pg'我会强制执行rake assets:precompile RAILS_ENV=production 并将public/assets更新添加到我的提交中。

如果您想重建资产,只需rm -rf public/assets 再次运行资产预编译命令。

你可以git rm public/assets --cached -rgit add public/assets

做一个提交并推送到heroku。

于 2012-06-03T12:58:01.527 回答
1

我只是猜测您没有运行迁移,因为pg gem隐藏在您的资产组中。heroku run rake db:migrate如果您尝试在这些条件下运行它们,您可能会在发布时遇到错误。

另外,我建议将您的薄宝石放在生产或全球环境中。确保你有一个Procfile,否则 heroku 将使用 webrick。

于 2012-06-03T13:09:15.483 回答
0

需要将此添加到production.rb

config.assets.precompile += %w( active_admin.css active_admin.js active_admin/print.css)
于 2012-10-03T01:45:33.693 回答
0

当我忘记运行 $ heroku run rake db:migrate 时,我收到了非常相似的错误消息。我创建了一个新的 Family 模型,并将应用程序的根设置为开发中的 family#show 页面。我收到了与部署到 Heroku 时相同的神秘错误消息,并且能够通过在生产数据库中运行迁移并在控制台中创建 Family 对象来解决它。

于 2013-01-27T22:50:20.903 回答