简体   繁体   English

Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError)

[英]Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError)

I'm trying to set up redmine on an managed server.我正在尝试在托管服务器上设置 redmine。 Redmine installation works, I can start the rails server and visit the redmine page localy with lynx. Redmine 安装成功,我可以启动 rails 服务器并使用 lynx 访问本地的 redmine 页面。 Integration in the Apache is done via FCGI and when I enter the redmine start page in my browser I get an Server error 500. In the server logs I see this: Apache 中的集成是通过 FCGI 完成的,当我在浏览器中进入 redmine 起始页时,我收到服务器错误 500。在服务器日志中,我看到:

Feb 18 01:17:12 dedi444 apache: /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/www/users/admin/redmine/config/boot.rb:4:in `<top (required)>'
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/www/users/admin/redmine/startup.rb:1:in `<main>'
Feb 18 01:17:12 dedi444 apache: /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/www/users/admin/redmine/config/boot.rb:4:in `<top (required)>'
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
Feb 18 01:17:12 dedi444 apache:         from /usr/www/users/admin/redmine/startup.rb:1:in `<main>'
Feb 18 01:17:18 dedi444 apache: [Tue Feb 18 01:17:18.386071 2020] [fcgid:info] [pid 31847:tid 140048663593024] mod_fcgid: process /usr/www/users/admin/test/dispatch.fcgi(3096) exit(communication error), terminated by calling exit(), return code: 1

I searched for the errormessage other answers recommended an bundle install - output is我搜索了其他答案推荐捆绑安装的错误消息- 输出是

...
Bundle complete! 27 Gemfile dependencies, 58 gems now installed.
Gems in the groups development, test and rmagick were not installed.
Bundled gems are installed into `/usr/home/admin/.gem`

EDIT additional info: I continued searching for answers, maybe the GEM_PATH is the problem and ruby can't find the bundle/setup.编辑附加信息:我继续寻找答案,也许 GEM_PATH 是问题所在,而 ruby​​ 找不到包/设置。 My fcgi script looks like this:我的 fcgi 脚本如下所示:

#!/bin/dash                                                                                                                                       
export GEM_HOME="$HOME/.gem/ruby/2.3.0/"
export GEM_PATH="$GEM_HOME:/var/lib/ruby/gems/1.8"
exec /usr/bin/ruby /usr/www/users/admin/redmine/startup.rb

How can I find the location of the 'bundle/setup' on my system?如何在我的系统上找到“捆绑/设置”的位置?

Any idea what I can do?知道我能做什么吗?

Thanks a lot Klaus非常感谢克劳斯

Looks that you have ambiguity with your ruby & gem paths.看起来您对 ruby​​ 和 gem 路径有歧义。 They are installed in /usr/home/admin/.gem and fcgi is trying to find them in /usr/lib/ruby/2.3.0/rubygems/ that's because Apache doesn't know where to look.它们安装在/usr/home/admin/.gem而 fcgi 试图在/usr/lib/ruby/2.3.0/rubygems/中找到它们,这是因为 Apache 不知道在哪里查找。

You should try passing env config variables via .htaccess file if your shared hosting system allows it or via apache config如果您的共享主机系统允许或通过 apache 配置,您应该尝试通过.htaccess文件传递 env 配置变量

SetEnv GEM_HOME /usr/home/admin/.gem

However, Redmine is preferably used via some application server (puma, thin, webrick...) , and reverse-proxied or run via Passenger as Apache module, and preferably it uses Ruby installed via rvm or rbenv...但是,Redmine 最好通过一些应用程序服务器(puma、thin、webrick...)使用,并通过Passenger 作为Apache 模块进行反向代理或运行,最好使用通过rvm 或rbenv 安装的Ruby...

Thus, depending upon version, it might also require you to add因此,根据版本,它可能还需要您添加

gem "fcgi" in Gemfile and run bundle install again, and also to add these lines in dispatch.fcgi Gemfile gem "fcgi"并再次运行bundle install ,并在dispatch.fcgi添加这些行

require 'rubygems'
require 'fcgi'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `require&#39;:无法加载此类文件-捆绑程序/安装程序(LoadError) - `require': cannot load such file — bundler/setup (LoadError) Rails服务器正常工作,Rails控制台无效。 `require&#39;:无法加载此类文件-捆绑程序/安装程序(LoadError)- - Rails server works, Rails console does not. `require': cannot load such file — bundler/setup (LoadError) - 需要“捆绑器”错误,无法加载此类文件 — 捆绑器 (LoadError) - require 'bundler' error, cannot load such file — bundler (LoadError) 运行cron job`require&#39;时出错:无法加载此类文件 - bundler / setup(LoadError) - Error running cron job `require': cannot load such file — bundler/setup (LoadError) Rails 4,ruby-2.0.0-p247,pow,rvm - LoadError:无法加载这样的文件 - bundler / setup - Rails 4, ruby-2.0.0-p247, pow, rvm - LoadError: cannot load such file — bundler/setup 制作新的Rails应用程序时,出现以下错误:`require&#39;:无法加载此类文件-捆绑程序(LoadError) - When making a new Rails app, I get the following error: `require': cannot load such file — bundler (LoadError) docker apache passenger:错误无法加载此类文件捆绑程序/安装程序(LoadError) - docker apache passenger: error cannot load such file bundler/setup (LoadError) LoadError:无法加载此类文件—捆绑程序/设置capistrano - LoadError: cannot load such file — bundler/setup capistrano 加载错误:无法加载此类文件 -- 捆绑程序/设置 - LoadError: cannot load such file -- bundler/setup 软件包安装错误后,kernel_require.rb:55:在&#39;require&#39;中:无法加载此类文件—捆绑程序(LoadError) - after bundle install error kernel_require.rb:55:in `require': cannot load such file — bundler (LoadError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM