2015-08-18 58 views
2

我在第一次在rails項目中設置Capistrano。當我運行「帽子生產部署:檢查」它確定。但是當我運行「cap prodution deploy」時,它會給出以下錯誤...Ruby on Rails,通過Capistrano部署設置錯誤

(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 127 
bundle stdout: Nothing written 
bundle stderr: /usr/bin/env: bundle: No such file or directory 

SSHKit::Command::Failed: bundle exit status: 127 
bundle stdout: Nothing written 
bundle stderr: /usr/bin/env: bundle: No such file or directory 

Tasks: TOP => deploy:updated => bundler:install 
(See full trace by running task with --trace) 
The deploy has failed with an error: Exception while executing as [email protected]: bundle exit status: 127 
bundle stdout: Nothing written 
bundle stderr: /usr/bin/env: bundle: No such file or directory 

我正在使用rails 4.2.3。 Ruby 2.2.2(帶有RVM)。我增加了對Capistrano的Gemfile中下面的寶石......

gem 'capistrano', '~> 3.4.0' 
gem 'capistrano-rvm', '~> 0.1.2' 
gem 'capistrano-bundler', '~> 1.1.4' 
gem 'capistrano-rails', '~> 1.1.3' 
gem 'capistrano3-unicorn', '~> 0.2.1' 
+0

如果您使用的是rvm,您將不得不在capistrano文件中爲您正在使用的ruby版本設置rvm字符串。像'set:rvm_ruby_string','ree @ rails3'' –

+0

'你是什麼意思「爲ruby版本設置rvm字符串」?我是這樣做的嗎? – polarcare

+0

在'config/deploy.rb'文件中,您應該添加rvm字符串,它基本上是您正在使用的ruby版本和gemset。 –

回答

1

您沒有安裝在服務器上的bundler寶石。看起來像這樣的線表示:

bundle stderr: /usr/bin/env: bundle: No such file or directory 

你需要安裝在服務器上bundler寶石,以便Capistrano的做這件事。

+1

我有同樣的問題(雖然沒有使用rvm):哪個軟件包返回哪個軟件包 /home/deploy/.gem/ruby/2.3.0/bin/bundle,路徑顯示echo $ PATH /home/deploy/.gem /ruby/2.3.0/bin:etc我可以在服務器上手動進入應用程序文件夾並運行bundle install,它運行正常,不在第3章下 – Mitch