当我运行部署脚本时,我遇到了错误:
[cb123fad] rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable) DEBUG [cb123fad] (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: Exception while executing as deploy@xx.xx.xx.xx: bundle exit status: 1 bundle stdout: rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable) bundle stderr: Nothing written SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx: bundle exit status: 1 bundle stdout: rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable) bundle stderr: Nothing written SSHKit::Command::Failed: bundle exit status: 1 bundle stdout: rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable) bundle stderr: Nothing written Tasks: TOP => deploy:initial (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as deploy@xx.xx.xx.xx: Exception while executing as deploy@xx.xx.xx.xx: bundle exit status: 1 bundle stdout: rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable) bundle stderr: Nothing written
Capfile
具有 set :rbenv_ruby, '2.2.3'
服务器和本地我已安装 ruby 2.2.3p173
将值更改2.2.3
为2.2.3p173
for set :rbenv_ruby
不起作用.
我解决了同样的问题设置:rbenv_path
.你的应该是:
set :rbenv_path, '/home/your/.rbenv/'
这必须在里面deploy.rb
.
上面的回答对我不起作用.gem update --system
,然后bundle install
会导致fatal: No live threads left. Deadlock?
错误.
bundle exec cap development deploy
如果 gem 'sshkit', '~> 1.7.1'
加速,则完成部署.
但是,可能出现的情况是sshkit
gem可能会更新1.8.0
或更高.在这种情况下,假设在deploy.rb中设置标准的Ubuntu服务器
set :rbenv_path, '$HOME/.rbenv'
将允许部署完成.
https://github.com/capistrano/sshkit/issues/303和https://github.com/capistrano/rbenv/pull/59
笔记
set :rbenv_path, '/home/your/.rbenv/' # works set :rbenv_path, '~your/.rbenv/' # doesn't work
由于sshkit的更改而创建此问题.
diff --git a/Gemfile.lock b/Gemfile.lock index b85dabe..a909ee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -57,6 +57,7 @@ GEM code_metrics (0.1.3) coderay (1.1.0) colored (1.2) + colorize (0.7.7) concord (0.1.5) adamantium (~> 0.2.0) equalizer (~> 0.0.9) @@ -215,7 +216,8 @@ GEM slop (3.6.0) spoon (0.0.4) ffi - sshkit (1.8.1) + sshkit (1.7.1) + colorize (>= 0.7.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) terminal-table (1.5.2)