Ruby rbenv:version`2.2.3';未安装(由RBENV_版本环境变量设置)

Ruby rbenv:version`2.2.3';未安装(由RBENV_版本环境变量设置),ruby,deployment,rbenv,capistrano3,ruby-on-rails-4.2,Ruby,Deployment,Rbenv,Capistrano3,Ruby On Rails 4.2,运行部署脚本时,出现错误: [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.

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

[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
has
set:rbenv\u ruby,“2.2.3”

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


set:rbenv\u ruby
的值从
2.2.3
更改为
2.2.3p173
无效。

我解决了相同的问题设置
:rbenv\u path
。你的应该是:
设置:rbenv_路径,'/home/your/.rbenv/'


这必须在
deploy.rb的内部

上面的Answare对我不起作用
gem更新——系统
,然后
bundle安装
将导致
致命错误:没有活动线程。死锁?
错误

bundle exec cap development deploy
如果指定了“~>1.7.1”,则完成部署

然而,可能发生的情况是,
sshkit
gem可能会更新到
1.8.0
或更高版本。在这种情况下,假设在deploy.rb中有一个标准的Ubuntu服务器设置

set :rbenv_path, '$HOME/.rbenv'
将允许完成部署。

注释

此问题是由于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)

你好不幸的是,仅仅在
Capfile
中添加
set:rbenv_path
对我不起作用。谢谢您的时间。这应该在deploy.rb中,而不是Capfile中。这对我来说是失败的
在deploy.rb中设置:rbenv_路径,~/.rbenv'
。路径是正确的,因为如果我修改它,cap会立即出错。。。这是最近引进的东西,;以前的部署工作正在进行。我真的不明白!你让我开心。我为这个问题挣扎了一个小时:)然而,奇怪的是,
ruby-v
在我的案例中显示了正确的版本,
bundle update
等也正常工作。因此,这似乎只与Capistrano的部署有关。如@jerome所述,您可以将路径缩写为通用路径:
$HOME/.rbenv
。这确实对我有用。
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)