升级到rails 3后,Rails 2.x mongrel将无法启动. - mongrel_rails(MissingSourceFile)

Tec*_*ism 4 macos mongrel ruby-on-rails

将我的Rails安装升级到OS X上的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'
Run Code Online (Sandbox Code Playgroud)

到目前为止,这是我尝试过的:

$ sudo gem update system
Run Code Online (Sandbox Code Playgroud)
$ sudo gem update
Run Code Online (Sandbox Code Playgroud)
$ sudo gem uninstall mongrel
Run Code Online (Sandbox Code Playgroud)
$ sudo gem install mongrel --include-dependencies
Run Code Online (Sandbox Code Playgroud)
$ which mongrel_rails
Run Code Online (Sandbox Code Playgroud)

/usr/bin/mongrel_rails

$ mongrel_rails start
Run Code Online (Sandbox Code Playgroud)

→成功,但没有标准

$ which mongrel_rails
Run Code Online (Sandbox Code Playgroud)

/usr/bin/mongrel_rails

$ rails _2.0.2_ test
Run Code Online (Sandbox Code Playgroud)

→新鲜应用有同样的问题.

  • 操作系统:OS X.6.x.
  • Rails:3.0.5(Rails 2.x应用程序存在问题)
  • gem -v:1.6.1
  • 杂种:杂种(1.1.5)

我已经在" - mongrel_rails(MissingSourceFile)"中阅读了每一个Google结果; 没有多少.

这里的任何人都可以告诉我如何进行调试吗?谢谢!

更新:

我现在尝试安装旧版本的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 由admin/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
...  
Run Code Online (Sandbox Code Playgroud)

这是得到一个文件未找到错误,所以它不是在我知道文件的位置...在命令行上运行mongrel_rails工作...哪个mongrel_rails显示它usr/bin,那么问题是什么?

Max*_*kov 6

我有同样的问题,找到了原因.

发生这种情况是因为当您需要"any_gem"时,新版本的RubyGems(1.6.2)不会将'any_gem/bin'添加到ruby加载路径($ LOAD_PATH).

例如,在RubyGems版本= 1.4.1中,这可以正常工作.在我需要'mongrel'后,我可以在加载路径中看到下一个:

  • ... RVM /宝石/红宝石1.8.7-P330 /宝石/杂种-1.1.5/bin中
  • ... RVM /宝石/红宝石1.8.7-P330 /宝石/杂种-1.1.5/lib目录
  • ... RVM /宝石/红宝石1.8.7-P330 /宝石/杂种-1.1.5/EXT

对于新版本(1.6.2),我只能看到:

  • ... RVM /宝石/红宝石1.8.7-P330 /宝石/杂种-1.1.5/lib目录
  • ... RVM /宝石/红宝石1.8.7-P330 /宝石/杂种-1.1.5/EXT

这就是为什么红宝石找不到'mongrel_rails'.