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

Askar picture Askar · Dec 7, 2015 · Viewed 10.8k times · Source

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.

Answer

yysskk picture yysskk · Dec 7, 2015

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

This must be inside of deploy.rb.