2015-12-07 18 views
7

Khi tôi chạy một kịch bản triển khai, tôi có lỗi:rbenv: phiên bản '2.2.3' không được cài đặt (do biến môi trường 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 

Capfileset :rbenv_ruby, '2.2.3'

Server và tại địa phương tôi đã cài đặt ruby 2.2.3p173

Thay đổi giá trị từ 2.2.3 thành 2.2.3p173 cho set :rbenv_ruby không hoạt động.

Trả lời

21

Tôi đã giải quyết cùng một vấn đề với cài đặt :rbenv_path. Bạn nên:
set :rbenv_path, '/home/your/.rbenv/'

Điều này phải nằm trong số deploy.rb.

+1

Xin chào! Thật không may, chỉ cần thêm 'set: rbenv_path' vào' Capfile' không hoạt động đối với tôi. Cảm ơn vì đã dành thời gian cho tôi. – Askar

+1

Điều này phải ở trong deploy.rb, không phải Capfile. –

+0

Vâng, tôi đã làm việc khi tôi chuyển sang 'deploy.rb'. – Askar

4

Câu trả lời ở trên không hiệu quả đối với tôi. gem update --system, sau đó bundle install sẽ dẫn đến lỗi fatal: No live threads left. Deadlock?.

bundle exec cap development deploy 

hoàn thành việc triển khai nếugem 'sshkit', '~> 1.7.1' được spedified.

Tuy nhiên, điều có thể xảy ra là sshkit đá quý có thể được cập nhật thành 1.8.0 trở lên. Trong trường hợp đó, giả định một tiêu chuẩn máy chủ Ubuntu thiết lập, trong deploy.rb

set :rbenv_path, '$HOME/.rbenv' 

sẽ cho phép triển khai để hoàn thành.

3

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

GHI CHÚ

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

Vấn đề này được tạo ra do sự thay đổi trong 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) 
Các vấn đề liên quan