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

StackOverflow https://stackoverflow.com/questions/18356742

Question

I am running Rails 3.2.14 under Ruby 2.0.0 (rvm) on OSX. When I attempt to access the ri documentation for most methods, I get the following stack trace.

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:

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. I have no issue accessing the documentation outside the context of my Rails project.

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.

Thanks very much!

Was it helpful?

Solution

I ended up biting the bullet and upgrading to Rails 4, which completely resolved the issue. The gem dependencies for Rails 4 and Ruby 2.0.0 are lined up.

For anyone interested in using RI without the option of upgrading to Rails 4, I'd recommend sticking with Ruby 1.9.3; this includes RDoc 3.12.2, which is compatible with the above Rails 3.2.14 dependencies.

OTHER TIPS

This probably means your missing [the correct version] of the rdoc gem. Try gem install rdoc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top