【发布时间】:2016-12-06 18:48:19
【问题描述】:
无法使用 capistrano 3 或远程服务器 rbenv ruby:
Capistrano Version: 3.6.1 (Rake Version: 11.3.0)
/Users/victorstan/.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'
/Users/victorstan/.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: which ruby exit status: 1
which ruby stdout: which: no ruby in (/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin)
which ruby stderr: Nothing written
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/command.rb:100:in `exit_status='
/Users/victorstan/.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'
/Users/victorstan/.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'
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap'
/Users/victorstan/.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'
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:60:in `capture'
config/deploy.rb:88:in `block (4 levels) in <top (required)>'
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:85:in `within'
config/deploy.rb:82:in `block (3 levels) in <top (required)>'
/Users/victorstan/.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'
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run'
/Users/victorstan/.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'
我的设置:
deploy.rb
set :rbenv_type, :user
set :rbenv_ruby, '1.9.3-p551' # same as in .ruby-version file
set :default_shell, '/bin/bash -l'
set :pty, true
within release_path do
ruby_v = capture("which ruby")
puts "Ruby version: #{ruby_v}"
end
Capfile
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Extra rails commands
require "capistrano/rails/collection"
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require 'capistrano/rvm'
require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# require 'capistrano/passenger'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
config / deploy / staging.rb
set :ssh_options, {
forward_agent: true,
auth_methods: %w(password),
password: 'xxx',
user: 'xxx',
}
【问题讨论】:
-
不知道是不是因为你有
ssh_options,查看capistrano-rbenv 源码-> github.com/capistrano/rbenv/blob/master/lib/capistrano/tasks/… -
顺便说一句,您使用的是哪个 gem 版本?
-
@faron 在这种情况下,唯一改变的是我被要求登录,除了上面列出的问题之外,我还看到了一条附加消息:
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text. -
Capistrano 版本:3.6.1(Rake 版本:11.3.0)
标签: ruby-on-rails rbenv capistrano3