gpt4 book ai didi

ruby-on-rails - 无法加载此类文件 -- rufus-scheduler (LoadError)

转载 作者:数据小太阳 更新时间:2023-10-29 09:03:37 26 4
gpt4 key购买 nike

虽然我不想排除我可能遗漏了一些非常愚蠢的东西,但我确实尝试阅读了我能找到的关于这个主题的所有内容,所以这是我的问题:

我正在尝试在我的 redmine (2.6) 安装中运行 rufus-scheduler,如下所述:http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails#Schedule-email-receiving-with-Rufus-Scheduler

主机系统是 CentOS 7 x64 + Plesk 12。

gem list 显示 rufus-scheduler (3.0.9)

重启redmine时,出现如下错误日志:

cannot load such file -- rufus-scheduler (LoadError)
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/var/www/vhosts/klwr.de/redmine.klwr.de/redmine-2.6.1/config/initializers/emailhandler.rb:3:in `<top (required)>'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:245:in `load'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:245:in `block in load'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/share/gems/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:245:in `load'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/engine.rb:592:in `each'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/engine.rb:592:in `block in <class:Engine>'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/local/share/gems/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/vhosts/klwr.de/redmine.klwr.de/redmine-2.6.1/config/environment.rb:14:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/usr/local/share/gems/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
/usr/local/share/gems/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/local/share/gems/gems/passenger-4.0.59/helper-scripts/rack-loader.rb:108:in `eval'
/usr/local/share/gems/gems/passenger-4.0.59/helper-scripts/rack-loader.rb:108:in `load_app'
/usr/local/share/gems/gems/passenger-4.0.59/helper-scripts/rack-loader.rb:127:in `<module:App>'
/usr/local/share/gems/gems/passenger-4.0.59/helper-scripts/rack-loader.rb:27:in `<module:PhusionPassenger>'
/usr/local/share/gems/gems/passenger-4.0.59/helper-scripts/rack-loader.rb:26:in `<main>'

我的第一个猜测是我需要将以下指令之一应用于 Apache:

RailsAppSpawnerIdleTime 0
PassengerMinInstances 1
PassengerSpawnMethod direct

但是,应用这些的任意组合只会更改错误日志,这样错误就不会发生在 rack-loader 中,而是发生在 rack-preloader 中。

显示 redmine 的包内容不会显示 rufus 调度程序。这可能是一个原因吗? (如果是,这应该在一些关于 redmine 的文档中提到)。

这是文件 config/initializers/emailhandler.rb 的完整内容:

require 'rubygems'
require 'rake'
require 'rufus-scheduler'

load File.join(Rails.root, 'Rakefile')

ENV['host']='xxx'
ENV['port']='25'
ENV['username']='xxx'
ENV['password']='xxx'
ENV['project']='xxx'
ENV['unknown_user']='accept'
ENV['no_permission_check']='1'

scheduler = Rufus::Scheduler.new
# Check emails every 1 mins
scheduler.in '1m' do
task = Rake.application['redmine:email:receive_imap']
task.reenable
task.invoke
end

感谢您花时间阅读此 + 以获取任何提示。祝你有美好的一天。

最佳答案

奇怪的是,作者建议不使用bundler直接安装gem。

我知道当 Redmine 启动时它只能看到“捆绑”的 gem 。意思是我推荐你加一行

gem 'rufus-scheduler' 

到 Gemfile,运行 bundle install 并尝试再次启动 Redmine。

关于ruby-on-rails - 无法加载此类文件 -- rufus-scheduler (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29300030/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com