Ruby 1.8上的Gem为Gem :: Specification:Class(NoMethodError)提供了“undefined method`dirs'”

时间:2012-05-15 11:20:43

标签: ruby-on-rails ruby rubygems

我在Rubygems(Ruby 1.8)中遇到NoMethodError错误。

这些是旧的Rails 2.3站点,所以我希望不必升级到1.9。

所有gem命令都会发生,包括gem -v

错误为rubygems.rb:959:in '_deprecated_source_index': undefined method 'dirs' for Gem::Specification:Class (NoMethodError)

这是完整的堆栈跟踪:

NOTE: Gem.searcher is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.searcher called from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:81.
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:959:in `_deprecated_source_index': undefined method `dirs' for Gem::Specification:Class (NoMethodError)
    from /usr/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:39:in `skip_during'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:958:in `_deprecated_source_index'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:63:in `send'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:63:in `source_index'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:13:in `initialize'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:951:in `new'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:951:in `_deprecated_searcher'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:63:in `send'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/deprecate.rb:63:in `searcher'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:50
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:8
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /usr/bin/gem:9

1 个答案:

答案 0 :(得分:0)

降级你的rubygems。您必须直接从源代码安装它,因为您的gem命令不起作用。

我自己使用Ruby 1.8.7,到目前为止似乎做得好的rubygems版本是1.6.0。

http://rubyforge.org/frs/?group_id=126