[英]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.