2015-04-02 13 views
3

我嘗試使用capistrano,passenger和nginx將部署rails項目添加到AWS服務器。但我無法部署它,因爲這個錯誤。/usr/bin/env:passenger:沒有這樣的文件或目錄並且退出狀態爲1(失敗)

INFO [0007b4de] Finished in 0.212 seconds with exit status 0 (successful). 
DEBUG [484bf595] Running /usr/bin/env [ -L /var/www/happyhour/releases/20150402075058/bin ] as [email protected] 
DEBUG [484bf595] Command: [ -L /var/www/myproject/releases/20150402075058/bin ] 
DEBUG [484bf595] Finished in 0.625 seconds with exit status 1 (failed). 
DEBUG [35fe9fd2] Running /usr/bin/env [ -d /var/www/myproject/releases/20150402075058/bin ] as [email protected] 
DEBUG [35fe9fd2] Command: [ -d /var/www/myproject/releases/20150402075058/bin ] 
DEBUG [35fe9fd2] Finished in 0.580 seconds with exit status 0 (successful). 

和bug。

DEBUG [38c8a3d8] /usr/bin/env: passenger: No such file or directory 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: passenger exit status: 127 
passenger stdout: Nothing written 
passenger stderr: /usr/bin/env: passenger: No such file or directory 

文件Capfile.rb

require 'capistrano/setup' 
require 'capistrano/deploy' 

require 'capistrano/rails' 
require 'capistrano/rails/assets' 
require 'capistrano/rails/migrations' 
require 'rvm1/capistrano3' 
# require "rvm/capistrano" 
require 'capistrano/bundler' 
require 'capistrano/passenger' 
# require 'whenever/capistrano' 
# require 'capistrano3/unicorn' 

Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 

文件deploy.rb

require 'rvm1/capistrano3' 
# require "rvm/capistrano" 
# require 'whenever/capistrano' 

lock '3.2.1' 

set :application, 'myproject' 
set :repo_url, '[email protected]:myname/myproject.git' 
set :deploy_to, '/var/www/myproject' 
set :keep_releases, 4 

set :rvm_type, :system 
set :rvm1_ruby_version, '2.2.0' 
#set :default_env, { rvm_bin_path: '~/.rvm/bin' } 
# set :default_env, { path: "/opt/ruby/bin:$PATH" } 


set :linked_dirs, %w{bin log tmp/backup tmp/pids tmp/cache tmp/sockets vendor/bundle} 
set :passenger_pid, "#{shared_path}/tmp/pids/passenger.pid" 

set :bundle_jobs, 4 

# set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" } 
# set :whenever_command, "bundle exec whenever" 

after 'deploy:publishing', 'deploy:restart' 
namespace :deploy do 
    task :restart do 
    invoke 'passenger:restart' 
    end 
end 

文件production.rb

set :branch, 'develop' 

role :app, %w{[email protected]} 
role :web, %w{[email protected]} 
role :db, %w{[email protected]} 

set :stage, :production 
set :rails_env, 'production' 

server 'IP Server', user: 'myname', roles: %w{web app db} 

請幫我這個bug。

感謝,

+1

我有同樣的問題,我提出了一個錯誤回購:https://github.com/capistrano/passenger/issues/26 – Jacob 2015-06-18 18:54:42

回答

0
rvmsudo ~/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14/bin/passenger-install-nginx-module 

有遊覽紅寶石版本(RVM)的(從Passenger installation with nginx fails獲得)

+0

嗨。 我試過了,但沒有通過。謝謝, – 2015-04-02 09:41:04

+0

@VoTienHung你試過運行passenger-install-nginx-module嗎? – Legendary 2015-04-02 09:45:25

+0

是的,我試過運行命令「rvmsudo passenger-install-nginx-module」並完成。但它沒有通過。 非常感謝, – 2015-04-02 09:49:28

1

作爲一種變通方法,嘗試把這個在全路徑的deploy.rb

set :passenger_restart_with_touch, true 

這樣做會跳過對乘客版本的檢查。欲瞭解更多信息,請參閱此GitHub issue

相關問題