Rails 4 和 ruby 2.5 的 Phusion Passenger 错误
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
我使用 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>'
==================================
答案:
答案是卸载stand alone Phusion Passenger,安装成gem,如下:
sudo apt-get remove -y passenger libapache2-mod-passenger
然后安装 gem
gem install passenger --no-rdoc --no-ri
passenger-install-apache2-module
按照安装说明进行操作
试试这个,
gem install bundler
和
bundle install
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>'
==================================
答案:
答案是卸载stand alone Phusion Passenger,安装成gem,如下:
sudo apt-get remove -y passenger libapache2-mod-passenger
然后安装 gem
gem install passenger --no-rdoc --no-ri
passenger-install-apache2-module
按照安装说明进行操作
试试这个,
gem install bundler
和
bundle install