无法加载这样的文件 - bundler / setup(LoadError) [英] cannot load such file -- bundler/setup (LoadError)

查看:180
本文介绍了无法加载这样的文件 - bundler / setup(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ruby 2.0设置了Rails 4应用程序,但是我得到了Web应用程序无法启动并获取此跟踪:

 无法加载这样的文件 -  bundler / setup(LoadError)
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in`require '
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in'require'
/usr/lib/ruby/gems/1.8/gems /passenger-4.0.19/lib/phusion_passenger/loader_shared_helpers.rb:212:in'run_load_path_setup_code'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack- preloader.rb:96:在`preload_app'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:150:in`< module :应用>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:29:in`< module:PhusionPassenger>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:28:in`< main>'

我的apache2.conf是:

  LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so 
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger -4.0.19
PassengerDefaultRuby / usr / local / bin / ruby​​

bundle -v 是:

  Bundler版本1.3.5 

ruby​​ -v 是:

  ruby​​ 2.0.0p247(2013-06-27 revision 41674)[x86_64-linux] 

gem env 是:

 <$ c $ RubyGems环境:
- RUBYGEMS版本:2.1.5
- RUBY VERSION:2.0.0(2013-06-27 patchlevel 247)[x86_64-linux]
- 安装目录:/ / usr / local / bin / ruby​​
- 可执行目录:/usr/lib/ruby/gems/1.8/bin
- SPEC CACHE DIRECTORY:/root/.gem/specs
- RUBYGEMS平台:
- ruby​​
- x86_64-linux
- 创业板路径:
- /usr/lib/ruby/gems/1.8
- 创业板配置:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- 远程源:
- https://rubygems.org/
- SHELL路径:
- /root/.gems/bin $ b $ - / usr / lib / ruby​​ / gems / 1.8 / bin /
- / usr / local / bin
- / usr / bin
- / bin
- / usr / bin / X11
- / usr / games
- / usr / sbin
- / sbin



< echo $ GEM_PATH 是:

  / usr / lib / ruby /gems/1.8:/usr/lib/ruby/gems/1.8 

不应该 GEM_PATH be /usr/lib/ruby/gems/2.0



在apache2.conf中的虚拟主机中添加:

  SetEnv GEM_HOME /usr/lib/ruby/gems/1.8 

现在它正在工作。



解决方案的正确方法是什么?解决方案

这可能是因为在安装之前在系统上安装了以前的Ruby env 2.0的?这可能有一个现有的GEM_PATH,导致/1.8目录仅安装2.0版本。

然后,您可能遇到的问题是Passenger / Apache正在查看/2.0目录,实际上这些gem位于/1.8目录中。您明确地告诉apache使用/1.8目录对于解决这个问题是有意义的。

  SetEnv GEM_HOME / usr / lib / ruby /gems/1.8 

您也可以尝试使用 Ruby Version Manager 来处理多个Ruby环境。



我在Google中找到的一些东西:




I'm setting Rails 4 application with Ruby 2.0, but I'm getting "Web application could not be started" and get this trace:

cannot load such file -- bundler/setup (LoadError)
  /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'
  /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in `require'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/lib/phusion_passenger/loader_shared_helpers.rb:212:in `run_load_path_setup_code'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:96:in `preload_app'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:150:in `<module:App>'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/helper-scripts/rack-preloader.rb:28:in `<main>'

My apache2.conf is:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.19
   PassengerDefaultRuby /usr/local/bin/ruby

bundle -v is:

Bundler version 1.3.5

ruby -v is:

ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

gem env is:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.1.5
  - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/lib/ruby/gems/1.8/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /root/.gems/bin
     - /usr/lib/ruby/gems/1.8/bin/
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/bin/X11
     - /usr/games
     - /usr/sbin
     - /sbin

echo $GEM_PATH is:

/usr/lib/ruby/gems/1.8:/usr/lib/ruby/gems/1.8

Shouldn't GEM_PATH be /usr/lib/ruby/gems/2.0?

Inside the virtual host in apache2.conf I added:

SetEnv GEM_HOME /usr/lib/ruby/gems/1.8

And now it is working.

Is it the right way to fix this?

解决方案

It could be that there was a previous Ruby env installed on your system prior to your installation of 2.0? This might have had an existing GEM_PATH that lead to the /1.8 directory which the installation of version 2.0 simply kept.

The problem you where likely having, then, was that Passenger/Apache was looking in the /2.0 directory when in fact the gems were in the /1.8 directory. Your explicitly telling apache to use the /1.8 directory thus makes sense to fix the problem.

SetEnv GEM_HOME /usr/lib/ruby/gems/1.8

You might also try using the Ruby Version Manager to handle multiple Ruby envs.

Some things I found in Google:

这篇关于无法加载这样的文件 - bundler / setup(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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