2013-05-28 40 views
1

我正在使Capistrano與Rails部署自動化,我在啓動乘客的過程結束時遇到錯誤。 我結束了以下錯誤:乘客啓動失敗,出現未初始化的常量錯誤

uninitialized constant PhusionPassenger::Standalone::Command::SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 

事實上,我發現,在[...]/phusion_passenger/constants.rb完美定義的SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION恆定。

下面是完整的堆棧跟蹤:

*** [err :: www.example.com] /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/command.rb:241:in `create_nginx_controller' 
*** [err :: www.example.com] : 
*** [err :: www.example.com] uninitialized constant PhusionPassenger::Standalone::Command::SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 
*** [err :: www.example.com] (
*** [err :: www.example.com] NameError 
*** [err :: www.example.com]) 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/start_command.rb:69:in `run' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:93:in `block in run_command' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:48:in `block in each_command' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:43:in `each' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:43:in `each_command' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:91:in `run_command' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:62:in `run!' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/lib/phusion_passenger/standalone/main.rb:39:in `run!' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/gems/passenger-4.0.4/bin/passenger:33:in `<top (required)>' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/bin/passenger:23:in `load' 
*** [err :: www.example.com] from /var/www/production/shared/bundle/ruby/1.9.1/bin/passenger:23:in `<main>' 

我添加了自定義任務開始,並從Capistrano的停止客運獨立,一切似乎跟預期包括Passegner的安裝,直到這個奇怪的錯誤。這裏是我的Capfile的相關部分:

set :passenger_cmd, "#{fetch(:bundle_cmd, "bundle")} exec passenger" 
namespace :deploy do 
    task :start, :roles => :app, :except => { :no_release => true } do 
    run "cd #{current_path} && #{passenger_cmd} start -e #{rails_env} -p #{passenger_port} -d" 
    end 

    task :stop, :roles => :app, :except => { :no_release => true } do 
    run "cd #{current_path} && #{passenger_cmd} stop -p #{passenger_port}" 
    end 

    task :restart, :roles => :app, :except => { :no_release => true } do 
    run <<-CMD 
     if [[ -f #{current_path}/tmp/pids/passenger.#{passenger_port}.pid ]]; 
     then 
     cd #{current_path} && #{passenger_cmd} stop -p #{passenger_port}; 
     fi 
    CMD 

    run "cd #{current_path} && #{passenger_cmd} start -e #{rails_env} -p #{passenger_port} -d" 
    end 
end 

我的完整的設置是如下:

  • 的Rails 3.2
  • RVM
  • Capistrano的
  • 客運獨立

回答

0

一種解決方法是降級到乘客4.0.3。

gem uninstall passenger 
gem install passenger --version="4.0.3" 

它看起來是4.0.4版本中的一個問題。

+0

是的。這是4.0.4中的一個錯誤。我已打開以下問題:https://code.google.com/p/phusion-passenger/issues/detail?id=899 – Hongli

+0

這是按預期工作的。謝謝! –

2

該錯誤在GitHub上的落實4ad928d中得到解決。

您可以嘗試使用GitHub存儲庫中的克隆,或者等待包含此修補程序的4.0.5版。

編輯:截至此刻版本4.0.5可用。

相關問題