2015-12-07 22 views
7

Quando eseguo uno script deploy, sto avendo errori:rbenv: versione 2.2.3' `non è installato (impostato dalla variabile d'ambiente RBENV_VERSION)

[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 ha set :rbenv_ruby, '2.2.3'

Server e localmente ho installato ruby 2.2.3p173

la modifica del valore 2.2.3-2.2.3p173 per set :rbenv_ruby non ha funzionato.

risposta

21

Ho risolto lo stesso problema impostando :rbenv_path. Distinti dovrebbe essere:
set :rbenv_path, '/home/your/.rbenv/'

Questo deve essere all'interno di deploy.rb.

+1

Ciao! Sfortunatamente l'aggiunta di 'set: rbenv_path' nel' Capfile' non ha funzionato per me. Grazie per il tuo tempo. – Askar

+1

Questo dovrebbe essere in deploy.rb, non in Capfile. –

+0

Sì, ho lavorato quando mi sono trasferito in 'deploy.rb'. – Askar

4

La risposta di cui sopra non ha funzionato per me. gem update --system, quindi bundle install causerebbe un errore fatal: No live threads left. Deadlock?.

bundle exec cap development deploy 

completa la distribuzione segem 'sshkit', '~> 1.7.1' disponibili sono riassunte.

Tuttavia, è possibile che sshkit gem venga aggiornato a 1.8.0 o superiore. In tal caso, ipotizzando un set-up del server Ubuntu di serie, in deploy.rb

set :rbenv_path, '$HOME/.rbenv' 

permetterà di completare le implementazioni.

3

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

NOTE

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

Questo problema è stato creato a causa di un cambiamento nella 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)