使用Rails 4和ruby 2.5的Phusion Passenger错误

时间:2018-04-03 08:31:07

标签: ruby-on-rails passenger

Ubuntu 16.04
Rails 4.2.10
Ruby 2.5.0
SERVER_SOFTWARE = Apache/2.4.18 (Ubuntu) Phusion_Passenger/5.2.2

我使用rbenv安装了ruby,当我这样做时

ruby -v

我得到了

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

我按如下方式安装了Phusion Passenger:

sudo apt-get install -y dirmngr gnupg
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
sudo apt-get install -y libapache2-mod-passenger
sudo a2enmod passenger
sudo apache2ctl restart

当我这样做时:

sudo /usr/bin/passenger-config validate-install

我明白了:

 * Checking whether this Passenger install is in PATH... ✓
 * Checking whether there are no other Passenger installations... ✓
 Everything looks good. :-)

但是,当我尝试启动我的应用程序时,收到一条错误消息:

Web application could not be started
Web application could not be started by the Phusion Passenger application server.

从/var/log/apache2/error.log,我得到:

Error ID: d8f774a0
Error details saved to: /tmp/passenger-error-ShCphj.html
Message from application: cannot load such file -- bundler/setup (LoadError)
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

================================

答案:

答案是卸载独立的Phusion Passenger,并将其安装为gem,如下所示:

sudo apt-get remove -y passenger libapache2-mod-passenger

然后安装宝石

gem install passenger --no-rdoc --no-ri
passenger-install-apache2-module

按照安装说明进行操作

1 个答案:

答案 0 :(得分:1)

试试这个,

gem install bundler 

bundle install