“no such file to load - bundler / setup”在Apache / Passenger服务器上 [英] "no such file to load -- bundler/setup" on Apache/Passenger server

查看:115
本文介绍了“no such file to load - bundler / setup”在Apache / Passenger服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图部署我的第一个Rails应用程序的草稿。它在我的本地WEBRick服务器上效果很好。



然而,在我的Ubuntu VPS上运行Apache2& Passenger,当我导航到我的浏览器中的应用程序时,我得到:

 错误消息:
没有这样的文件load-bundler / setup
异常类:
LoadError

backtrace:

  0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in`gem_original_require'
1'require'中的/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36
2 /home/user/public/foo.com/config/boot.rb 6
3 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in`gem_original_require'
4 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in'require'
5 /home/user/public/foo.com/config/application.rb 1
6 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in`gem_original_require'
7'require'中的/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36
8 /home/user/public/foo.com/config/env ironment.rb 2
9 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in`gem_original_require'
10 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require。 rb 36 in`require'
11 config.ru 3
12 /usr/lib/ruby/vendor_ruby/rack/builder.rb 51 in`instance_eval'
13 / usr / lib / ruby /vendor_ruby/rack/builder.rb 51 in`initialize'
14 config.ru 1 in`new'
15 config.ru 1

这个应用程序是用Ruby v1.9.3(或者我认为)构建的,我已经在Ubuntu上安装了它(在应用程序根目录中, ruby -v 返回 ruby​​ 1.9.3p286(2012-10-12修订版37165)[i686-linux] )。



根据此问题,我在应用程序根目录中运行了 gem install bundle bundle install 。我还从本地计算机中将正确的 gemset 导入到VPS应用程序根目录。



根据这个问题,我试图将gem集更改为 /home/user/.rvm/gems/ruby-1.9.3-p286@foo (其中foo是正在使用的gemset的名称),但这只是让回溯时间更长。



任何有助于进一步解决问题的帮助将非常感谢!



编辑:我最终通过卸载Rails,RVM,Ruby(一个RVM版本)&乘客重新安装Rails,Passenger& Ruby(但不是RVM)。

解决方案

如何设置正确的值

如果您不确定将passenger_ruby设置为什么值,那么您可以找到如下正确的值。

首先,找出乘客的位置-config工具并记下它:

  which passenger-config 
/ opt / passenger / bin / passenger- config

接下来,激活您要使用的Ruby解释器(如果适用,gemset)。例如,如果您使用的是RVM,并且您使用的是Ruby 2.2.1,则可能需要运行以下命令:

  rvm use 2.2 .1 

最后,以其完整路径调用passenger-config,传递--ruby-command作为参数:

$ p $ / opt / passenger / bin / passenger-config --ruby-command
passenger-config被调用以下Ruby解释器:
命令:/usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
版本:ruby 1.8.7(2012-02-08 patchlevel 358)[universal -darwin12.0]
在Apache中使用:PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
在Nginx中使用:passenger_ruby / usr / local / rvm / wrappers / ruby​​-1.8.7-p358 / ruby​​
使用独立版本:/usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby/opt/custom/bin/assist start

## RVM用户注释
您是否想知道为不同的Ruby解释器使用哪个命令? 'rvm use',即Ruby解释器,然后重新运行'passenger-config --ruby-command'。

输出告诉您要设置的值。



现在执行下面的命令,它对我很有帮助,现在可以在/etc/apache2/mods-

  a2dismod乘客
a2enmod乘客
服务apache2重启


I'm trying to deploy a draft of my first Rails app. It works great on my local WEBRick server.

However, on my Ubuntu VPS running Apache2 & Passenger, when I navigate to the app in my browser, I get:

Error message:
no such file to load -- bundler/setup
Exception class:
LoadError

With the following backtrace:

0   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `gem_original_require'
1   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `require'
2   /home/user/public/foo.com/config/boot.rb    6   
3   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `gem_original_require'
4   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `require'
5   /home/user/public/foo.com/config/application.rb 1   
6   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `gem_original_require'
7   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `require'
8   /home/user/public/foo.com/config/environment.rb 2   
9   /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `gem_original_require'
10  /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb    36  in `require'
11  config.ru   3   
12  /usr/lib/ruby/vendor_ruby/rack/builder.rb   51  in `instance_eval'
13  /usr/lib/ruby/vendor_ruby/rack/builder.rb   51  in `initialize'
14  config.ru   1   in `new'
15  config.ru   1   

The app was built with Ruby v1.9.3 (or so I thought), which I've installed on Ubuntu (in the app root, ruby -v returns ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]).

As per this question, I've run gem install bundle and bundle install in the app root. I've also imported the correct gemset from my local machine to the VPS app root.

As per this question, I attempted to change the gem set to /home/user/.rvm/gems/ruby-1.9.3-p286@foo (where foo is that name of the gemset in use), but this just made the backtrace longer.

Any help further troubleshooting this would be much appreciated!

EDIT: I finally got my app functioning by uninstalling Rails, RVM, Ruby (an RVM version) & Passenger before reinstalling Rails, Passenger & Ruby (but not RVM).

解决方案

How to set the correct value

If you are not sure what value to set passenger_ruby to, then you can find out the correct value as follows.

First, find out the location to the passenger-config tool and take note of it:

    which passenger-config
    /opt/passenger/bin/passenger-config

Next, activate the Ruby interpreter (and if applicable, the gemset) you want to use. For example, if you are on RVM and you use Ruby 2.2.1, you may want to run this:

    rvm use 2.2.1

Finally, invoke passenger-config with its full path, passing --ruby-command as parameter:

    /opt/passenger/bin/passenger-config --ruby-command
    passenger-config was invoked through the following Ruby interpreter:
      Command: /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
      Version: ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
      To use in Apache: PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-   p358/ruby
      To use in Nginx : passenger_ruby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
      To use with Standalone: /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby /opt/passenger/bin/passenger start

    ## Notes for RVM users
    Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'.

The output tells you what value to set.

Now goto passenger.conf in /etc/apache2/mods-available directory and paste required lines shown above.

Now execute following commands and it worked for me,

    a2dismod passenger
    a2enmod passenger
    service apache2 restart

这篇关于“no such file to load - bundler / setup”在Apache / Passenger服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆