乘客错误'无法加载此类文件:... union_station_hooks_core'

时间:2016-03-03 08:13:15

标签: ruby-on-rails passenger

我的rails应用程序出现以下错误:

Web application could not be started

cannot load such file -- /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core (LoadError)
  /u/sf/netmon/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /u/sf/netmon/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/ruby_supportlib/phusion_passenger.rb:235:in `require_passenger_lib'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:232:in `before_loading_app_code_step1'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/helper-scripts/rack-preloader.rb:99:in `preload_app'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/helper-scripts/rack-preloader.rb:29:in `<main>'
Error ID
28518bd5

查看文件系统:

-bash-4.1$ pwd
/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core
-bash-4.1$ tree
.

0 directories, 0 files

所以显然确实没有这样的文件......我该如何解决这个问题?

我的Gemfile:

source 'https://rubygems.org'

gem 'rails', git: 'https://github.com/rails/rails', branch: '4-2-stable'
gem 'actionpack-action_caching'

gem 'pg'
gem 'redis'

gem 'rubytree'

gem 'turbolinks'
gem 'jquery-rails'
gem 'jquery-datatables-rails', git: 'https://github.com/rweng/jquery-datatables-rails'
gem 'rails-timeago'
gem 'dygraphs-rails'
gem 'underscore-rails'
gem 'd3_rails'
gem 'twitter-bootstrap-rails', '= 2.2.8'
gem 'less-rails'
gem 'coffee-rails', git: 'https://github.com/rails/coffee-rails'
gem 'coffeebeans'
gem 'jquery-ui-rails'

group :assets do
  gem 'sass-rails',   git: 'https://github.com/rails/sass-rails', branch: '5-0-stable'
  gem 'therubyracer', platforms: :ruby
  gem 'uglifier', '>= 1.0.3'
end

gem 'jbuilder', '~> 1.0.1'
gem 'passenger', git: 'https://github.com/FooBarWidget/passenger', branch: 'stable-5.0'
gem 'rack-webauth'

gem 'bunny'

通过ruby-build安装了ruby 2.3.0,并且乘客的apache模块报告没有错误:

$ ./passenger-install-apache2-module

...

Validating installation...

 * Checking whether this Passenger install is in PATH... (!)

   Please add /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/passenger-e139c4cd3ebd/bin to PATH.
   Otherwise you will get "command not found" errors upon running
   any Passenger commands.

   Learn more at about PATH at:

     https://www.phusionpassenger.com/library/indepth/environment_variables.html#the-path-environment-variable

 * Checking whether there are no other Passenger installations... ✓
 * Checking whether Apache is installed... ✓
 * Checking whether the Passenger module is correctly configured in Apache... ✓

Detected 0 error(s), 1 warning(s).
Press ENTER to continue.

2 个答案:

答案 0 :(得分:1)

似乎是通过乘客github快速搜索帮助......

union_station_hooks_core和union_station_hooks_rails都是主乘客git repo上的git子模块。所以修改我的gemfile以包含submodules: true将拉入所需的文件。

gem 'passenger', \
  git: 'https://github.com/FooBarWidget/passenger', \
  branch: 'stable-5.0', \
  submodules: true

答案 1 :(得分:0)

我有同样的问题。这是因为你的乘客不满。 全程乘客将通过制造。 只需下载这样的所需版本

wget http://s3.amazonaws.com/phusion-passenger/releases/passenger-5.0.26.tar.gz

并提取到 / opt / passenger 然后重新运行 passenger-install-nginx-module 并将其添加到PATH -

echo 'PATH=/opt/passenger/bin:$PATH' >>etc/profile
PATH=/opt/passenger/bin:$PATH
export PATH
passenger-config validate-install

不要忘记在http部分

中正确
http {
  ...
  passenger_root /opt/passenger;
  passenger_ruby /usr/bin/ruby;
  ...
}