简体   繁体   中英

Phusion Passenger error with Rails 4 and ruby 2.5

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

I installed ruby using rbenv, and when I do

ruby -v

I get

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

I installed Phusion Passenger as follows:

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

When I do:

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

I get:

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

However, when I try to start my application, I get an error message:

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

From the /var/log/apache2/error.log, I get:

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>'

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

Answer:

The answer is to uninstall stand alone Phusion Passenger, and install it as a gem, as follows:

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

Then installing the gem

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

Follow the install directions

Try this,

gem install bundler 

and

bundle install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM