在OS上将Rails安装升级到Rails 3之后,我在使用Mongrel运行Rails 2.x开发站点时遇到了问题。WEBrick似乎可以工作,但我真的很想拥有Mongrel的良好输出来进行调试。
在运行$ script/server之后,我得到了以下内容:
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load': no such file to load -- mongrel_rails (MissingSourceFile)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `gem_original_require'到目前为止,我尝试过的是:
$ sudo gem update system$ sudo gem update$ sudo gem uninstall mongrel$ sudo gem install mongrel --include-dependencies$ which mongrel_rails→/usr/bin/mongrel_rails
$ mongrel_rails start→成功,但没有标准
$ which mongrel_rails→/usr/bin/mongrel_rails
$ rails _2.0.2_ test→新应用程序也有同样的问题。
gem -v:1.6.1我读过"-- mongrel_rails (MissingSourceFile)“上的每一个谷歌结果,没有多少。
这里有人能告诉我如何进行调试吗?谢谢!
更新:
现在,我尝试安装gem的旧版本,并在Rails 2.x站点的config/environment.rb文件中指定这些版本。我已经尝试过1.1.5、1.1.4和1.2.0pre。
所有这些都没有丝毫的区别。
由于usr/bin中的可执行文件,我想知道这是否是在Rails 3安装中出错的文件所有权问题,以及在运行时是否有一个文件没有得到我的路径?
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb是由管理员/ root拥有的,所以应该没有问题,对吗?
这会是active_support的问题吗?
下面是dependencies.rb中抛出错误的代码:
484 class Object
485
486 alias_method :load_without_new_constant_marking, :load
487
488 def load(file, *extras) #:nodoc:
489 Dependencies.new_constants_in(Object) { super(file, *extras) }
490 rescue Exception => exception # errors from loading file
491 exception.blame_file! file
492 raise
493 end
... 这是一个文件找不到错误,所以它没有查看我知道文件是…的位置在命令行上运行mongrel_rails工作…哪个mongrel_rails在usr/bin中显示了它,那么问题是什么?
发布于 2011-04-19 22:57:16
您需要在加载路径中添加"/usr/bin“。也许里面有什么东西破了?
修复它的最佳方法是添加:
$:.push("/usr/bin/")在它破裂之前的某个地方。如果您没有一个config/preinitializer.rb文件,那么它可能本身就存在。
发布于 2011-03-15 16:59:37
我也遇到了同样的问题,并找到了原因。
这是因为新版本的RubyGems(1.6.2)在需要"any_gem“时不向RubyGems ($LOAD_PATH)添加”any_gem/bin“。
例如,在RubyGems版本= 1.4.1中,这很好。在我需要'mongrel‘之后,接下来可以在加载路径中看到:
对于新版本(1.6.2),我只能看到:
这就是为什么ruby找不到'mongrel_rails‘的原因。
发布于 2011-03-10 22:30:47
好吧,这里有一个答案。我得到了boot...but的mongrel --这太麻烦了,并且没有解决真正的problem...but,至少现在我可以继续做这个项目了。
我就是这么做的.是的.太讨厌了。
我编辑了抛出error...dependencies.rb的文件
我添加了一个钩子来调用mongrel的特定路径,如果这是它试图加载的文件。
def load(file, *extras) #:nodoc:
if file == "mongrel_rails"
file ="/usr/bin/mongrel_rails"
end
Dependencies.new_constants_in(Object) { super(file, *extras) }
rescue Exception => exception # errors from loading file
exception.blame_file! file
raise
end再说一遍,我真的很想解决根本的问题-- here...but --至少让我启动。
https://stackoverflow.com/questions/5228091
复制相似问题