0

以下是 capistrano 日志:

The deploy has failed with an error: Exception while executing as deploy@server: rake exit status: 1
rake stdout: rake aborted!
NoMethodError: undefined method `each' for #<String:0x0000000411b0d0>
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/connection_specification.rb:149:in `resolve_all'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_handling.rb:73:in `resolve'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/core.rb:46:in `configurations='
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/railtie.rb:122:in `block (2 levels) in <class:Railtie>'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `each'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/railtie.rb:121:in `block in <class:Railtie>'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
/home/deploy/apps/project_name/releases/20170302140850/config/environment.rb:5:in `<top (required)>'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:328:in `require_environment!'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:448:in `block in run_tasks_blocks'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/home/deploy/apps/project_name/shared/bundle/ruby/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:74:in `load'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:74:in `kernel_load'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli/exec.rb:27:in `run'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli.rb:335:in `exec'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli.rb:20:in `dispatch'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/cli.rb:11:in `start'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/exe/bundle:32:in `block in <top (required)>'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/home/deploy/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.5/exe/bundle:24:in `<top (required)>'
/home/deploy/.rvm/gems/ruby-2.3.0/bin/bundle:23:in `load'
/home/deploy/.rvm/gems/ruby-2.3.0/bin/bundle:23:in `<main>'
/home/deploy/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/home/deploy/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
rake stderr: Nothing written

暂存环境可以成功部署。另外,当我bundle exec rake assets:precompile在本地运行时,它也成功了。

所以错误在这里:

def resolve_all
  config = configurations.dup
  config.each do |key, value|         
    config[key] = resolve(value) if value
  end
  config
end

这是一个错误activerecord-5.0.2吗?现在我无法理解源代码,有什么帮助吗?

4

0 回答 0