Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 332
Askar Avatar asked Dec 07 '15 04:12

Askar


2 Answers

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

This must be inside of deploy.rb.

like image 187
yysskk Avatar answered Sep 22 '22 13:09

yysskk


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)
like image 29
paul.belt Avatar answered Sep 22 '22 13:09

paul.belt