Bundler无法找到乘客的宝石

时间:2017-10-11 15:12:07

标签: ruby-on-rails passenger

Rails 5.1
Ruby 2.4
Ubuntu 16.04
Passenger 5.1.8

我的Gemfile没有乘客宝石

我的apache2虚拟主机配置文件如下所示:

<VirtualHost *:80>
    ServerAdmin  admin@myapp.com
    ServerName  myapp.com
    DocumentRoot "/home/utils/rails/public"
    PassengerRuby /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby
    PassengerAppEnv production
    PassengerFriendlyErrorPages on
    <Directory "/home/utils/rails/public">
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
    LogLevel warn
    ErrorLog ${APACHE_LOG_DIR}/follower_wonk_error.log
    CustomLog ${APACHE_LOG_DIR}/follower_wonk_access.log combined
</VirtualHost>


ls -l /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby

给了我:

-rwxrwxr-x 1 utils utils 274 Oct 11 14:50 /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby

和mods-available / passenger.conf在其中:

<IfModule mod_passenger.c>
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/passenger_free_ruby
</IfModule>

但是,当我做的时候

curl http://myapp.com

我得到一个例外。我复制了扩展错误html文件,这是其中的一部分:

-------- The exception is as follows: -------

Could not find passenger-5.1.8 in any of the sources (Bundler::GemNotFound)
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:87:in `block in materialize'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `map!'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `materialize'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:159:in `specs'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:218:in `specs_for'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:207:in `requested_specs'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/runtime.rb:109:in `block in definition_method'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/runtime.rb:21:in `setup'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler.rb:101:in `setup'
  /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/setup.rb:19:in `<top (required)>'
  /home/utils/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /home/utils/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296: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>'

但乘客5.1.18在那里。

我也跑了:

rvmsudo passenger-config validate-install

我得到了:

Everything looks good. :-)
乘客和阿帕奇的

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

如果您使用的是apache,则不需要Gemfile中的require位,即使用rails serverhttps://www.phusionpassenger.com/library/dev/ruby/rails_integration.html#rails-server-integration