rubyrequirerdoc

`require': cannot load such file -- rdoc/usage (LoadError)


I'm getting this error when running my script:

`require': cannot load such file -- rdoc/usage (LoadError)

from

/Users/S/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rdoc/usage (LoadError)
from /Users/S/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from pdf.rb:34:in `<main>'

I have rdoc in my Gemfile

gem 'rdoc', '~> 4.2.2'

and I have also tried without specifying version. In my script I've required gems and rdoc/usage:

require 'rubygems'
require 'rdoc/usage'

I have run gem install rdoc

Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-4.2.2

and as I'm running ruby 2.2.2 should not need to install ruby roc/ri data. (I tried at a loss and as expected no effect).

Any help would be greatly appreciated, thanks.


Solution

  • The old rdoc/usage module was removed from rdoc quite some time ago, namely in Ruby 1.9.1 (when rdoc was still part of the Ruby core language). See https://bugs.ruby-lang.org/issues/2713 for a discussion or the SVN commit.

    Thus, with recent Rubies, there is no way to use this module anymore. You should update your code to use alternatives to generate documentation.