2012-05-12 187 views
0

當我嘗試啓動了MacPorts的安裝軌道的WEBrick服務器上的Ruby把它放下像一年後重新回到我的回報率培訓我得到了執行ruby -d script/server以下錯誤:ROR的WEBrick服務器啓動錯誤

Exception `LoadError' at /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:1215 - no such file to load -- rubygems/defaults/operating_system 
Exception `NoMethodError' at /opt/local/lib/ruby/1.8/rational.rb:78 - undefined method `gcd' for Rational(1, 2):Rational 
Exception `Gem::LoadError' at /opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247 - Could not find memcache-client (>= 1.7.4) amongst [abstract-1.0.0, actionmailer-3.0.3, actionmailer-2.3.8, actionpack-3.0.3, actionpack-2.3.8, activemodel-3.0.3, activerecord-3.0.3, activerecord-2.3.8, activeresource-3.0.3, activeresource-2.3.8, activesupport-3.0.3, activesupport-2.3.8, arel-2.0.6, builder-2.1.2, bundler-1.0.7, cgi_multipart_eof_fix-2.5.0, daemon_controller-0.2.6, daemons-1.1.0, erubis-2.6.6, fastthread-1.0.7, gem_plugin-0.2.3, i18n-0.5.0, mail-2.2.12, mime-types-1.16, mongrel-1.1.5, mysql-2.8.1, mysql2-0.2.10, passenger-3.0.7, polyglot-0.3.1, rack-1.2.1, rack-1.1.0, rack-mount-0.6.13, rack-test-0.5.6, rails-3.0.3, rails-2.3.8, railties-3.0.3, rake-0.8.7, rubygems-update-1.8.5, sqlite3-ruby-1.3.2, thor-0.14.6, treetop-1.4.9, typhoeus-0.3.3, tzinfo-0.3.23, xml-simple-1.1.1] 
     /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/vendor.rb:32: warning: redefine normalize_translation_keys 
Exception `TypeError' at (eval):4 - can't modify frozen object 
Exception `MissingSourceFile' at /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- fast_xs 
Exception `MissingSourceFile' at /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:62 - no such file to load -- fast_xs 
Exception `NameError' at /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55 - uninitialized constant ActiveSupport::Dependencies::Mutex 
     /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError) 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:57 
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:1 
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 

所引起這些錯誤,因爲Rails項目我做之前,與舊的寶石或Ruby版本(我每次更新我的MacPorts的時間沒有更新)製成?我該如何補救?

更新

實測值Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)這是類似的。現在更新寶石並儘快重試。

更新2級

更新了所有的寶石剛剛得到一個錯誤:

Updating mysql2 
ERROR: While executing gem ... (Gem::GemNotFoundException) 
    Could not find a valid gem 'mysql2' (0.3.11) locally or in a repository 

錯誤:

ruby script/server 
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError) 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:57 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
    from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:1 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
    from script/server:3 

依然存在,但可能需要某種形式重啓

更新3

我將require 'thread'添加到config/boot.rb的頂部,如前面提到的線程的@thekingoftruth的答案中所建議的。現在Webrick開始了。我收到很多錯誤仍然說:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:21. 
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#refresh! called from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/vendor_gem_source_index.rb:34. 
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#load_gems_in called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:320. 
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#add_spec called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127. 
+1

我建議安裝rvm(Ruby版本管理器 - https://rvm.io/rvm/basics/)或rbenv(簡單Ruby版本管理 - https://github.com/sstephenson/rbenv)來管理你的紅寶石安裝和不使用的MacPorts - 然後創建一個新的軌道爲你的訓練3+的應用程序行使 – house9

+0

會考慮RVM。 Thanks @ house9這僅僅是我使用MacPorts來處理許多我需要的* Nix程序,我喜歡我可以在不使用虛擬機的情況下在Mac上更新它們的方式。但是運行RVM可能對RoR更方便。 – rhand

回答

0

正如更新中所示,我自己解決了這個問題。我現在在我的OSX Lion上使用RVM。