我在运行脚本时遇到此错误:
`require': cannot load such file -- rdoc/usage (LoadError)
来自
/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>'
我的 Gemfile 中有 rdoc
gem 'rdoc', '~> 4.2.2'
我也尝试过不指定版本。在我的脚本中,我需要 gems 和 rdoc/usage:
require 'rubygems'
require 'rdoc/usage'
我已经运行了 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
因为我正在运行 ruby 2.2.2,所以不需要安装 ruby roc/ri 数据。 (我试了亏,果然没有效果)。
任何帮助将不胜感激,谢谢。
最佳答案
旧的 rdoc/usage
模块很久以前就从 rdoc 中删除了,即在 Ruby 1.9.1 中(当时 rdoc 仍然是 Ruby 核心语言的一部分)。参见 https://bugs.ruby-lang.org/issues/2713进行讨论或 SVN commit .
因此,对于最近的 Rubies,无法再使用此模块。您应该更新您的代码以使用替代方案来生成文档。
关于ruby - `require' : cannot load such file -- rdoc/usage (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39875498/