Passenger bundler / setup LoadError

时间:2013-10-23 14:28:57

标签: ruby-on-rails ruby passenger gitlab

我与Redmine passenger error有类似的错误。我试图让GitLab与Apache和Passenger合作,没有运气。我坚持这个错误:

 cannot load such file -- bundler/setup (LoadError)
      /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
      /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:219:in `block in run_load_path_setup_code'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:333:in `running_bundler'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:217:in `run_load_path_setup_code'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:96:in `preload_app'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:150:in `'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `'

根据Andriy的建议,我尝试使用:

安装bundler gem
sudo gem install bundler

安装后我重新启动了apache2服务,但错误仍然相同。

VirtualHost定义为:

<VirtualHost *:80>
        ServerName localhost

        # Point this to your public folder of gitlab
        DocumentRoot /home/git/gitlab/public
        <Directory /home/git/gitlab/public>
                Allow from all
                Options -MultiViews
        </Directory>

        PassengerRuby /usr/bin/ruby

        # Custom log file locations
        ErrorLog  /var/log/apache2/gitlab_error.log
        CustomLog /var/log/apache2/gitlab_access.log combined
</VirtualHost>
<Location /users/auth/shibboleth/callback>
  AuthType shibboleth
  ShibRequestSetting requireSession 1
  require valid-user
</Location>
<Location /Shibboleth.sso>
  SetHandler shib
</Location>

有人可以解释这个问题吗?

2 个答案:

答案 0 :(得分:2)

在我的例子中,附加到apache配置文件的行如下:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.24/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.24
PassengerDefaultRuby /usr/bin/ruby1.8

但该应用程序使用ruby 2.0.0,因此我在应用程序的apache虚拟主机配置文件中指定了不同的路径(使用'PassengerRuby')之后解决了错误,如下所示:

(“... VirtualHost *:80&gt;

ServerName www.yourhost.com

**PassengerRuby /home/user/.rvm/gems/ruby-2.0.0-p247**
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /somewhere/public    
  <Directory /somewhere/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
  </Directory>

答案 1 :(得分:1)

昨天我遇到了一个非常类似的问题。我正在运行最新的Redmine完全安装在非root用户帐户中。我拥有支持该帐户中安装的Redmine(包括 bundler)的所有宝石,显然还有GEM_HOME /home/www-adm/.gem-home的非标准{。}}。

Startup抱怨无法加载bundler;但错误信息并不完全相同:

*** Exception LoadError in PhusionPassenger::ClassicRails::ApplicationSpawner (no such file to load -- bundler) (process 166395, thread #<Thread:0x7fce7910b360>):

我可以通过在Apache配置的Redmine相关部分中设置GEM_HOME环境变量来解决这个问题,如下所示:

SetEnv GEM_HOME /home/www-adm/.gem-home

这并不意味着相同(当然,使用适合您自己安装的路径名)对您的情况有帮助,但可能值得一试。

但也许你还没有安装bundler