我正在使用ruby守护程序gem为我的rails项目创建自定义守护程序。唯一的问题是当我尝试启动守护进程ruby lib/daemons/test_ctl start
时它失败并且无法启动。日志文件具有此输出。
# Logfile created on Wed Oct 22 16:14:23 +0000 2008 by /
*** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally \*\*\*
# MissingSourceFile: no such file to load -- utf8proc_native
*** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***
# NoMemoryError: failed to allocate memory>
# SystemStackError: stack level too deep>
# fatal: exception reentered>
# LoadError: no such file to load -- daemons>
# LoadError: no such file to load -- active_support>
# MissingSourceFile: no such file to load -- lib/string>
# MissingSourceFile: no such file to load -- utf8proc_native>
当我生成一个守护进程(来自rails插件)并尝试运行它时,它甚至会发生。有人知道如何解决这个问题吗?
答案 0 :(得分:3)
好的,我实际上找到了这个问题的答案。我在config/environment.rb
中需要两个自定义文件。我使用了相对路径名,因为守护进程在rails主目录中执行,所以无法找到这两个文件。在使它们成为绝对路径后,它解决了问题。
答案 1 :(得分:1)
在尝试让守护程序插件正常工作时,我花了30分钟试图解决类似的错误:
LoadError: no such file to load -- active_support
出于某种原因,它没有找到active_support
lib,即使它已安装。 (也许是因为我有冰冻的铁轨)
在我的例子中,解决方法是在我的中使用active_support的绝对路径
ctl文件(例如lib/daemons/mailer_ctl
)。
我需要更改第5行:
require 'active_support'
到
require './vendor/rails/activesupport/lib/active_support.rb'