0

当我尝试启动安装了 Ruby on Rail Webrick Server 的 MacPorts 以在放下它一年后重新开始我的 RoR 培训时,我在执行时遇到以下错误ruby -d script/server

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 项目是使用较旧的 Gems 或 Ruby 版本(每次更新我的 MacPorts 时都会更新)?我该如何补救?

更新

找到类似的未初始化常量 ActiveSupport::Dependencies::Mutex (NameError)。现在更新宝石并很快重试。

更新 2

更新了所有的 gem 只出现了一个错误:

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'按照前面提到的线程中@thekingoftruth 的答案中的建议添加到 config/boot.rb 的顶部。现在 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.
4

1 回答 1

0

如更新所示,我自己解决了这个问题。我现在在我的 OSX Lion 上使用 RVM。

于 2012-05-13T01:53:22.983 回答