cap生产部署NoMethodError:未定义的方法`each'代表“3w”:字符串

时间:2016-11-13 06:22:56

标签: ruby-on-rails-4 capistrano

我正在尝试将我的应用部署到服务器,但我一直在收到错误,而我无法找到解决方案。

我跑的时候:

  

捆绑exec cap production deploy --trace

输出是:

** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env 
** Invoke rbenv:validate (first_time)
** Execute rbenv:validate
** Invoke rbenv:map_bins (first_time)
** Execute rbenv:map_bins
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
      01 mkdir -p /tmp
    ✔ 01 deploy@server's-Ip 0.587s
      Uploading /tmp/git-ssh-myapp-production-root.sh 100.0%
      02 chmod 700 /tmp/git-ssh-myapp-production-root.sh
    ✔ 02 deploy@server's-Ip 0.112s
** Execute git:check
00:00 git:check
      01 git ls-remote --heads git@github.com:mygiuser/myapp.git
      01 *********************************** refs/heads/master
    ✔ 01 deploy@server's-Ip 3.695s
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
00:04 deploy:check:directories
      01 mkdir -p /home/deploy/myapp/shared /home/deploy/myapp/releases
    ✔ 01 deploy@server's-Ip 0.109s
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
00:04 deploy:check:linked_dirs
      01 mkdir -p /home/deploy/myapp/shared/bin /home/deploy/myapp/shared/log /home/deploy/myapp/shared/tmp/pids /home/deploy/myapp/…
    ✔ 01 deploy@server's-Ip 0.113s
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
00:04 deploy:check:make_linked_dirs
      01 mkdir -p /home/deploy/myapp/shared/config
    ✔ 01 deploy@server's-Ip 0.127s
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke deploy:updating (first_time)
** Invoke deploy:new_release_path (first_time)
** Execute deploy:new_release_path
** Execute deploy:updating
** Invoke git:create_release (first_time)
** Invoke git:update (first_time)
** Invoke git:clone (first_time)
** Invoke git:wrapper 
** Execute git:clone
00:05 git:clone
      The repository mirror is at /home/deploy/myapp/repo
** Execute git:update
00:05 git:update
      01 git remote update --prune
      01 Fetching origin
    ✔ 01 deploy@server's-Ip 5.720s
** Execute git:create_release
00:11 git:create_release
      01 mkdir -p /home/deploy/myapp/releases/20161112203915
    ✔ 01 deploy@server's-Ip 0.115s
      02 git archive master | tar -x -f - -C /home/deploy/myapp/releases/20161112203915
    ✔ 02 deploy@server's-Ip 0.140s
** Invoke deploy:set_current_revision (first_time)
** Execute deploy:set_current_revision
** Invoke git:set_current_revision (first_time)
** Execute git:set_current_revision
00:11 git:set_current_revision
      01 echo "d081a7ed762d31da5a114b712b1ed8087898ccc2" >> REVISION
    ✔ 01 deploy@server's-Ip 0.108s
** Invoke deploy:symlink:shared (first_time)
** Execute deploy:symlink:shared
** Invoke deploy:symlink:linked_files (first_time)
** Execute deploy:symlink:linked_files
00:12 deploy:symlink:linked_files
      01 mkdir -p /home/deploy/myapp/releases/20161112203915/config
    ✔ 01 deploy@server's-Ip 0.109s
      02 rm /home/deploy/myapp/releases/20161112203915/config/database.yml
    ✔ 02 deploy@server's-Ip 0.114s
      03 ln -s /home/deploy/myapp/shared/config/database.yml /home/deploy/myapp/releases/20161112203915/config/database.yml
    ✔ 03 deploy@server's-Ip 0.113s
** Invoke deploy:symlink:linked_dirs (first_time)
** Execute deploy:symlink:linked_dirs
00:12 deploy:symlink:linked_dirs
      01 mkdir -p /home/deploy/myapp/releases/20161112203915 /home/deploy/myapp/releases/20161112203915/tmp /home/deploy/myapp/releases/…
    ✔ 01 deploy@server's-Ip 0.103s
      02 rm -rf /home/deploy/myapp/releases/20161112203915/bin
    ✔ 02 deploy@server's-Ip 0.107s
      03 ln -s /home/deploy/myapp/shared/bin /home/deploy/myapp/releases/20161112203915/bin
    ✔ 03 deploy@server's-Ip 0.104s
      04 rm -rf /home/deploy/myapp/releases/20161112203915/log
    ✔ 04 deploy@server's-Ip 0.115s
      05 ln -s /home/deploy/myapp/shared/log /home/deploy/myapp/releases/20161112203915/log
    ✔ 05 deploy@server's-Ip 0.134s
      06 ln -s /home/deploy/myapp/shared/tmp/pids /home/deploy/myapp/releases/20161112203915/tmp/pids
    ✔ 06 deploy@server's-Ip 0.132s
      07 ln -s /home/deploy/myapp/shared/tmp/cache /home/deploy/myapp/releases/20161112203915/tmp/cache
    ✔ 07 deploy@server's-Ip 0.108s
      08 ln -s /home/deploy/myapp/shared/tmp/sockets /home/deploy/myapp/releases/20161112203915/tmp/sockets
    ✔ 08 deploy@server's-Ip 0.108s
      09 ln -s /home/deploy/myapp/shared/vendor/bundle /home/deploy/myapp/releases/20161112203915/vendor/bundle
    ✔ 09 deploy@server's-Ip 0.111s
      10 ln -s /home/deploy/myapp/shared/public/system /home/deploy/myapp/releases/20161112203915/public/system
    ✔ 10 deploy@server's-Ip 0.116s
      11 ln -s /home/deploy/myapp/shared/public/assets /home/deploy/myapp/releases/20161112203915/public/assets
    ✔ 11 deploy@server's-Ip 0.115s
** Invoke deploy:updated (first_time)
** Invoke bundler:install (first_time)
** Execute bundler:install
00:15 bundler:install
      01 $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/myapp/shared/bundle --without development test --deployment --quiet
    ✔ 01 deploy@server's-Ip 1.179s
** Execute deploy:updated
** Invoke deploy:compile_assets (first_time)
** Invoke deploy:set_rails_env 
** Execute deploy:compile_assets
** Invoke deploy:assets:precompile (first_time)
** Execute deploy:assets:precompile
00:17 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 rake aborted!
      01 NoMethodError: undefined method `each' for "3w":String
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:1…
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:69:in `resolve'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:46:in `configurations='
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Rai…
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
      01 /home/deploy/myapp/releases/20161112203915/config/environment.rb:5:in `<top (required)>'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
      01 /home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
      01 /home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
      01 /home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
      01 Tasks: TOP => environment
      01 (See full trace by running task with --trace)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@server's-Ip: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `each' for "3w":String
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:150:in `resolve_all'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:69:in `resolve'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:46:in `configurations='
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/deploy/myapp/releases/20161112203915/config/environment.rb:5:in `<top (required)>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/deploy/myapp/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/myapp/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `each' for "3w":String
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:150:in `resolve_all'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:69:in `resolve'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:46:in `configurations='
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/deploy/myapp/releases/20161112203915/config/environment.rb:5:in `<top (required)>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/deploy/myapp/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/myapp/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/command.rb:100:in `exit_status='
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:148:in `execute_command'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:74:in `execute'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-rails-1.1.8/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:93:in `with'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-rails-1.1.8/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:85:in `within'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-rails-1.1.8/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run'
/home/sol/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile
The deploy has failed with an error: Exception while executing as deploy@server's-Ip: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `each' for "3w":String
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:150:in `resolve_all'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:69:in `resolve'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:46:in `configurations='
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/home/deploy/myapp/releases/20161112203915/config/environment.rb:5:in `<top (required)>'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/deploy/myapp/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/myapp/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
** Invoke deploy:failed (first_time)
** Execute deploy:failed


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'

/home/deploy/myapp/releases/20161112203915/config/environment.rb:5:in `<top (required)>'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'

/home/deploy/myapp/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'

/home/deploy/myapp/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/myapp/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'

/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `load'

/home/deploy/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'

 DEBUG [dfeef303]   Tasks: TOP => environment

 DEBUG [dfeef303]   (See full trace by running task with --trace)

我的Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/spree'
require 'capistrano/rails'
require 'capistrano/rbenv'

set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.3.1'

Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

deploy.rb:

# config valid only for Capistrano 3.1
lock '3.6.1'

set :application, 'myapp'
set :repo_url, 'git@github.com:mygituser/myapp.git'

set :deploy_to, '/home/deploy/myapp'
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :ssh_options, {:forward_agent => true}
set :use_sudo, false



#default_run_options[:shell] = '/bin/bash --login'
#default_environment["RAILS_ENV"] = 'production'


namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end
after 'deploy:updated', 'deface:precompile'

  after :publishing, 'deploy:restart'
  after :finishing, 'deploy:cleanup'
end

以前有人遇到过这个错误吗?或知道如何解决它?

更新 database.yml的:

default: &default
  adapter: mysql2
  encoding: utf8
  collation: utf8_general_ci
  pool: 5
  username: myusername
  password: mypassword
  socket: /var/run/mysqld/mysqld.sock

development:
  <<: *default
  database: myapp_development


test:
  <<: *default
  database: myapp_test

production:
  <<: *default
  database: myapp_production
  username: myapp
  password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>

Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.6'
gem 'mysql2', '>= 0.3.13', '< 0.5'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
# gem 'bcrypt', '~> 3.1.7'
gem 'spree', '~> 3.1.0'
gem 'spree_auth_devise', '~> 3.1.0'
gem 'spree_gateway', '~> 3.1.0'
gem 'unicorn'

group :development do
  gem 'web-console', '~>2.3.0'
  gem 'byebug' ,'~>9.0.6'
  gem 'spring' ,'~>1.2.0'
  gem 'debug_inspector' ,'~>0.0.2'
  gem 'binding_of_caller' ,'~>0.7.2'
end
group :development, :production do
  gem "capistrano", "~> 3.6"
  gem 'capistrano-bundler', '~> 1.1.2'
  gem 'capistrano-rails', '~> 1.1.1'
  gem 'capistrano-rbenv', github: "capistrano/rbenv"
  gem 'capistrano-spree', '~> 1.0.0'
  gem 'capistrano-passenger', require: false, github: 'capistrano/passenger'
end 

group :production do
 gem 'therubyracer'
 gem 'execjs'
end

1 个答案:

答案 0 :(得分:0)

我通过从链接文件设置和.gitignore中删除database.yml来修复主要错误,并在服务器上创建它。