rbenv:未安装版本“2.2.3”(由 RBENV_VERSION 环境变量设置)

rbenv: version `2.2.3' is not installed (set by RBENV_VERSION environment variable)

当我 运行 部署脚本时,出现错误:

[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

Capfileset :rbenv_ruby, '2.2.3'

服务器和本地我都安装了ruby 2.2.3p173

set :rbenv_ruby 的值从 2.2.3 更改为 2.2.3p173 无效。

我解决了同样的问题设置: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'加速。

但是,可能发生的情况是 sshkitgem 可能会更新到 1.8.0 或更高。在这种情况下,假设标准 Ubuntu 服务器设置,在 deploy.rb

set :rbenv_path, '$HOME/.rbenv'

将允许部署完成。

https://github.com/capistrano/sshkit/issues/303 and 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)