[英]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. 安装任何新gem时,会引发NoMethodError异常。 I googled about it and searched issues in RDoc and RubyGems GitHub repositories, but had no luck.
我搜索了它并搜索了RDoc和RubyGems GitHub存储库中的问题,但没有运气。
My Ruby version is 我的Ruby版本是
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
The RubyGems version is RubyGems版本是
$ gem -v
2.5.1
The installed RDoc version is 安装的RDoc版本是
$ gem search rdoc -l
*** LOCAL GEMS ***
rdoc (4.2.2, 4.2.1)
I installed Ruby with RVM on Mac OS X El Capitan. 我在Mac OS X El Capitan上安装了带RVM的Ruby。
Thanks! 谢谢!
[UPDATE] 2018/08/03 [更新] 2018/08/03
I haven't used my Macbook for long time, so I forgot the problem until now. 我没有长时间使用我的Macbook,所以直到现在我才忘记了这个问题。 The day before yesterday I got an answer notification and today I checked my situation with the same Macbook.
前天我收到了答复通知,今天我用相同的Macbook检查了我的情况。 I found that I no longer have the problem and the Ruby and Gems were updated as follows:
我发现我不再有问题,Ruby和Gems更新如下:
$ 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. 谢谢。
When installing rdoc it tries to generate its own documentation using rdoc. 安装rdoc时,它尝试使用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.
二进制文件已安装(可能在/ usr / bin中),但在gem安装时才会找到 - 如果这是第一次。
gem install rdoc --no-document
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
. 安装
compass
。 After adding /home/myusername/.gem/ruby/2.5.0/bin
to $PATH
, this worked for me: 将
/home/myusername/.gem/ruby/2.5.0/bin
添加到$PATH
,这对我/home/myusername/.gem/ruby/2.5.0/bin
:
$ 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.