2017-09-13 75 views
0

我正在嘗試與Capistrano部署Rails應用程序。它基於Rails 5.1。 Ruby版本由rvm管理。 我正在使用ruby 2.2.3,手動創建gemset。 這裏是deploy.rbCapistrano/rails無法與rvm配合使用

set :rvm_type, :user 
set :rvm_ruby_version, '[email protected]' 
... 
with RAILS_ENV: fetch(:environment) do 
    execute :rake, "webpacker:install" 
end 

所以,似乎工作時,Rails的< 5.0。但是,當滑軌> 5.0,的WebPack應該通過這個命令安裝:

bundle exec rails webpacker:install (而不是捆綁耙)

with RAILS_ENV: fetch(:environment) do 
    execute :rails, "webpacker:install" 
end 

但它不爲我工作。我已經安裝了捆綁在寶石我使用,但得到的錯誤:

01 bundle exec rails webpacker:install 
01 bash: bundle: command not found 
(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: rails 
    exit status: 127 
    rails stdout: Nothing written 
    rails stderr: bash: bundle: command not found 

當然,我包括Capistrano的/軌在我capfile。

capistrano/rvm 
capistrano/rails 

我不知道爲什麼我得到錯誤。我認爲我配置正確,但... 無論如何,你想幫我解決這個問題嗎?

+0

爲什麼了創建gemsets?捆綁商現在是否完全不需要這樣做? – bkunzi01

+0

bkunzi01 - 我不確定你的意思。 bundler安裝在gemset裏面。 – Deimos620

回答

1

您可以使用capistrano/bundler

+0

感謝您的快速響應。我重新定義了任務並獲得了另一個錯誤。 (回溯限制爲導入任務) cap aborted! SSHKit :: Runner :: ExecuteError:執行[email protected]時出現異常:捆綁包退出狀態:1 捆綁stdout:沒有寫入 捆綁stderr:沒有寫入 任何想法爲什麼? – Deimos620

+1

心靈解釋你的答案,否則這是更好的評論,因爲它本質上只是一個鏈接 – engineersmnky