Ruby ri工具不起作用。

时间:2013-07-11 00:07:13

标签: ruby macos

我正在尝试使用ri工具,无法使它们工作。我尝试了rvm docs generate以及rvm docs generate-ri。都没有解决这个问题。我使用的是Mac OSx版本10.8.2。

由于

$ ri String
/Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:546:in `load': undefined class/module Encoding (ArgumentError)
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:546:in `load_cache'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:545:in `open'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:545:in `load_cache'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:384:in `initialize'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/paths.rb:54:in `each'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:378:in `initialize'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:355:in `new'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:355:in `run'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/bin/ri:12
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/bin/ri:19:in `load'
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/bin/ri:19
    from /Users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/bin/ruby_noexec_wrapper:14

1 个答案:

答案 0 :(得分:1)

看起来your version of rdoc(4.0.1)非常新。正如@theTinMan指出的那样,如果可能的话,你可能想要将ruby版本提升到1.9.x或2.0.0。

或者,您可以尝试删除4.0.1并安装3.12.2,这是rubygems上最新的3.x版本。


我挖掘源代码以确定rdoc正在尝试Marshal.load a cache file.也许您想要清除缓存并重新运行rvm docs generate-ri以确保缓存编码准确无误