【问题标题】:Capistrano deploy composer errorCapistrano 部署作曲家错误
【发布时间】:2014-09-29 05:50:09
【问题描述】:

使用退出代码运行 capistrano deploy 时出现 composer 错误:

composer exit status: 2

这是错误的完整日志:

Invoke deploy:updated (first_time)
Invoke composer:install (first_time)
Execute composer:install
Invoke composer:run (first_time)
Execute composer:run
INFO[28cd8f39] Running /usr/bin/env composer install --no-dev --no-interaction --verbose --optimize-autoloader on mydomain.com
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host mydomain.com: composer exit status: 2
composer stdout: Nothing written
composer stderr: Nothing written
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:27:in `block (4 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:26:in `block (3 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
SSHKit::Command::Failed: composer exit status: 2
composer stdout: Nothing written
composer stderr: Nothing written
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:27:in `block (4 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/var/lib/gems/1.9.1/gems/capistrano-composer-0.0.4/lib/capistrano/tasks/composer.rake:26:in `block (3 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/var/lib/gems/1.9.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => composer:run
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host mydomain.com: composer exit status: 2
composer stdout: Nothing written
composer stderr: Nothing written
>
** Invoke deploy:failed (first_time)
** Execute deploy:failed

我正在使用 capistrano 3.2.0 版和最新版本的 capistrano-composer。

可能是什么问题?

【问题讨论】:

    标签: capistrano composer-php capistrano3


    【解决方案1】:

    (问题已在 cmets 或编辑中回答。见 Question with no answers, but issue solved in the comments (or extended in chat))

    OP 写道:

    不知何故,问题出在 composer install 命令中。我已经通过在 composer install 之前运行 composer update 解决了这个问题,并且部署成功了。

    这是在 composer:install 之前运行 composer:update 的代码。

    namespace :composer do
        before 'install', 'change_dir'
    
        desc 'Composer update'
        task :change_dir do
            on roles(:app) do
                execute "cd #{release_path}/ && composer update"
            end
        end
    end
    

    【讨论】:

      猜你喜欢
      • 2021-06-11
      • 1970-01-01
      • 2015-03-22
      • 2013-04-05
      • 2015-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      相关资源
      最近更新 更多