Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `reset' for RDoc::TopLevel:Class when installing a new Ruby gem

For example,

$ gem install netaddr
Fetching: netaddr-1.5.1.gem (100%)
Successfully installed netaddr-1.5.1
ERROR:  While executing gem ... (NoMethodError)
    undefined method `reset' for RDoc::TopLevel:Class

The NoMethodError exception keeps being raised when I install any new gem. I googled about it and searched issues in RDoc and RubyGems GitHub repositories, but had no luck.

My Ruby version is

$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

The RubyGems version is

$ gem -v
2.5.1

The installed RDoc version is

$ gem search rdoc -l

*** LOCAL GEMS ***

rdoc (4.2.2, 4.2.1)

I installed Ruby with RVM on Mac OS X El Capitan.

Thanks!

[UPDATE] 2018/08/03

I haven't used my Macbook for long time, so I forgot the problem until now. The day before yesterday I got an answer notification and today I checked my situation with the same Macbook. I found that I no longer have the problem and the Ruby and Gems were updated as follows:

$ gem install netaddr
Fetching: netaddr-2.0.3.gem (100%)
Successfully installed netaddr-2.0.3
Parsing documentation for netaddr-2.0.3
Installing ri documentation for netaddr-2.0.3
Done installing documentation for netaddr after 1 seconds
1 gem installed

$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]

$ gem -v
2.6.8

$ gem search rdoc -l

*** LOCAL GEMS ***

rdoc (default: 5.0.0)

I don't remember when I updated them, but the problem has gone anyway, I guessed it was a bug and fixed in the updates.

Thanks.

like image 518
Huioon Kim Avatar asked Aug 17 '16 04:08

Huioon Kim


2 Answers

When installing rdoc it tries to generate its own documentation using rdoc. The binary is installed (probably in /usr/bin), but it will not be found at the moment of gem install - if this is the first time. gem install rdoc --no-document

like image 92
kwerle Avatar answered Sep 19 '22 08:09

kwerle


I had a similar issue:

$ gem install rdoc
Fetching: rdoc-6.0.4.gem (100%)
WARNING:  You don't have /home/myusername/.gem/ruby/2.5.0/bin in your PATH,
      gem executables will not run.
Successfully installed rdoc-6.0.4
ERROR:  While executing gem ... (NoMethodError)
    undefined method `reset' for RDoc::TopLevel:Class

Same when installing compass. After adding /home/myusername/.gem/ruby/2.5.0/bin to $PATH, this worked for me:

$ gem install rdoc
Successfully installed rdoc-6.0.4
Parsing documentation for rdoc-6.0.4
Installing ri documentation for rdoc-6.0.4
Done installing documentation for rdoc after 3 seconds
1 gem installed
like image 24
Pieter Avatar answered Sep 22 '22 08:09

Pieter