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

3

7

When I run a deploy script, I'm having errors:

[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 [email protected]: Exception while executing as [email protected]: 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 [email protected]: 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 [email protected]: Exception while executing as [email protected]: 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_ruby, '2.2.3'

Server and locally I have installed ruby 2.2.3p173

Changing the value from 2.2.3 to 2.2.3p173 for set :rbenv_ruby didn't work.

Coadjutrix answered 7/12, 2015 at 4:39 Comment(0)
C
23

I solved the same problem setting :rbenv_path. Yours should be:
set :rbenv_path, '/home/your/.rbenv/'

This must be inside of deploy.rb.

Constantin answered 7/12, 2015 at 9:24 Comment(5)
Hi! Unfortunately just adding set :rbenv_path in the Capfile didn't work for me. Thanks for your time.Coadjutrix
This should be in deploy.rb, not Capfile.Hooten
This fails for me set :rbenv_path, '~/.rbenv' in deploy.rb. The path is correct because if I alter it, cap immediately hits an error... This is something introduced recently; previous deploys were working. I really don't get itIndex
Thanx! You made my day. I was struggling with this problem for an hour :) However, strange, cause ruby -v showed correct version in my case, and bundle update etc. worked also OK. So this seems exclusively related to deployment with Capistrano.Garlen
Like @jerome mentioned, you could abbreviate the path to a generic one: $HOME/.rbenv. This did work for me.Hankow
K
7

https://github.com/capistrano/sshkit/issues/303 and https://github.com/capistrano/rbenv/pull/59

NOTES

set :rbenv_path, '/home/your/.rbenv/' # works
set :rbenv_path, '~your/.rbenv/' # doesn't work

This issue is created due to a change in 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)
Khalid answered 11/12, 2015 at 16:57 Comment(0)
I
5

The above answere did not work for me. gem update --system, then bundle install would lead to a fatal: No live threads left. Deadlock? error.

bundle exec cap development deploy

completes the deployment if gem 'sshkit', '~> 1.7.1' is spedified.

However, what may occur is that sshkitgem might get updated to 1.8.0or greater. In that case, assuming a standard Ubuntu server set-up, in deploy.rb

set :rbenv_path, '$HOME/.rbenv'

will allow deployments to complete.

Index answered 10/12, 2015 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.