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

2

11

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.

Entozoon answered 17/8, 2016 at 4:32 Comment(3)
I have exactly the same environment as you do, except for ruby version (mine is ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]), and had no problem installing the gem.Zennie
I've got the same problem as OP with ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] & gem 2.7.7 and for me it happened while installing rdoc itself: rdoc-6.0.4Reprimand
Did anyone figure this out?Tribune
B
9

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

Bruno answered 29/12, 2018 at 1:14 Comment(0)
K
3

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
Kilderkin answered 31/7, 2018 at 13:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.