Задать вопрос
@Kiiin

Как исправить ошибку «cap aborted! rbenv: bundle: command not found»?

При деплое я получаю такую ошибку:
> cap production deploy

{...}
DEBUG[d1dd96ac]     rbenv: bundle: command not found
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 185.162.92.85: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:35:in `block (5 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:26:in `block (4 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:25:in `block (3 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
SSHKit::Command::Failed: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:35:in `block (5 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:26:in `block (4 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/capistrano-bundler-1.1.3/lib/capistrano/tasks/bundler.cap:25:in `block (3 levels) in <top (required)>'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/deployer/.rvm/gems/ruby-2.2.10/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xx.xx: bundle exit status: 127
bundle stdout: Nothing writte
bundle stderr: rbenv: bundle: command not found

Как я могу это исправить? Мой Capfile и другая информация:
*Capfile*
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'whenever/capistrano'
require 'capistrano/sidekiq'
require 'capistrano/slackify'
set :rbenv_ruby, '2.2.10'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

> ruby -v
ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]

> bundler -v
Bundler version 1.17.3

> which ruby
/home/deployer/.rvm/rubies/ruby-2.2.10/bin/ruby

> which bundle
/home/deployer/.rvm/gems/ruby-2.2.10/bin/bundle
  • Вопрос задан
  • 104 просмотра
Подписаться 1 Сложный Комментировать
Пригласить эксперта
Ответы на вопрос 3
@AVKor

require 'capistrano/rbenv'
> which ruby
/home/deployer/.rvm/rubies/ruby-2.2.10/bin/ruby


Такое сочетание не смущает?
Ответ написан
@vsuhachev
Похоже, что у вас на удаленном хосте не установлен бандлер. Для старых версий руби он не был дефолтным гемом. Вам нужно его поставить руками на удаленном хосте, зайдя туда по ssh

gem install bundler
Ответ написан
@Brother-Ur
Смотрите, у вас бандлер установлен в системе управления RVM и он же используется. Это видно по путям и на это указали товарищи выше. А при запуске капистрано использует rbenv, пытается найти там бандлер и не находит. Поэтому выпадает с ошибкой.
Варианты решения:
1. Проверьте, что через rbenv установлен банлер нужной версии. Возможно его там просто нет.
2. Проверьте, что он стоит по умолчанию. Возможно, он есть но версии руби переписаны локально и поэтому не находится.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы