简体   繁体   English

Ruby RI失败了RDoc :: Context :: Section的实例需要有方法`marshal_load'(TypeError)

[英]Ruby RI fails with instance of RDoc::Context::Section needs to have method `marshal_load' (TypeError)

I am running Rails 3.2.14 under Ruby 2.0.0 (rvm) on OSX . 在OSX上的Ruby 2.0.0(rvm)下运行Rails 3.2.14 When I attempt to access the ri documentation for most methods, I get the following stack trace. 当我尝试访问大多数方法的ri文档时,我得到以下堆栈跟踪。

stack trace: 堆栈跟踪:

/Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `load': instance of RDoc::Context::Section needs to have method `marshal_load' (TypeError)
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `block in load_class'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `open'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `load_class'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:609:in `block in classes_and_includes_for'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `map'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `classes_and_includes_for'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:681:in `display_class'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:712:in `display_name'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:739:in `block in display_names'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:736:in `each'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:736:in `display_names'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:1137:in `run'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:320:in `run'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/bin/ri:12:in `<top (required)>'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ri:23:in `load'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ri:23:in `<main>'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ruby_noexec_wrapper:14:in `<main>'

I believe that the problem relates to Ruby 2 defaulting to RDoc 4.0 , while the bundler environment is using RDoc 3.12.2 due to dependencies: 我相信这个问题与Ruby 2默认为RDoc 4.0有关 ,而捆绑环境由于依赖关系而使用RDoc 3.12.2

journey-1.0.4 depends on rdoc (~> 3.11, development)
journey-1.0.4 depends on rdoc (~> 3.10, development)
tilt-1.4.1 depends on rdoc (>= 0, development)
tilt-1.4.1 depends on rdoc (>= 0, development)
mail-2.5.4 depends on rdoc (>= 0, development)
rdoc-3.12.2 depends on rdoc (~> 3.10, development)
railties-3.2.14 depends on rdoc (~> 3.4)
kaminari-0.14.1 depends on rdoc (>= 0, development)
arel-3.0.2 depends on rdoc (~> 3.10, development)
nokogiri-1.6.0 depends on rdoc (~> 3.10, development)
launchy-2.3.0 depends on rdoc (~> 3.12, development)
oauth2-0.8.1 depends on rdoc (>= 0, development)
sqlite3-1.3.7 depends on rdoc (~> 3.10, development)
uglifier-2.1.1 depends on rdoc (>= 3.11, development)

My guess is that when gem generates the ri documentation, it is using rdoc 4.0.0 but then 3.12.2 is being used to try and read it. 我的猜测是,当gem生成ri文档时,它使用的是rdoc 4.0.0,但之后使用3.12.2来尝试读取它。 I have no issue accessing the documentation outside the context of my Rails project. 我在Rails项目的上下文之外访问文档没有问题。

Any suggestions? 有什么建议么? I'm guessing this may no longer be an issue in Rails 4 , but that isn't really an option at the moment. 我猜这可能不再是Rails 4中的一个问题,但目前这不是一个真正的选择。

Thanks very much! 非常感谢!

I ended up biting the bullet and upgrading to Rails 4 , which completely resolved the issue. 我最终咬紧牙关并升级到Rails 4 ,这完全解决了这个问题。 The gem dependencies for Rails 4 and Ruby 2.0.0 are lined up. Rails 4Ruby 2.0.0的gem依赖关系排成一行

For anyone interested in using RI without the option of upgrading to Rails 4 , I'd recommend sticking with Ruby 1.9.3 ; 对于任何有兴趣使用RI但没有选择升级到Rails 4的人 ,我建议坚持使用Ruby 1.9.3 ; this includes RDoc 3.12.2 , which is compatible with the above Rails 3.2.14 dependencies. 这包括RDoc 3.12.2 ,它与上面的Rails 3.2.14依赖项兼容。

This probably means your missing [the correct version] of the rdoc gem. 这可能意味着您缺少rdoc gem的[正确版本]。 Try gem install rdoc . 试试gem install rdoc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM