Ruby: require 'irbtools' raises LoadError

怎甘沉沦 提交于 2020-01-03 05:17:12

问题


I installed the irbtools gem, but I can't require it.

$ sudo gem1.9.1 install irbtools
Successfully installed irbtools-0.8.7
1 gem installed
Installing ri documentation for irbtools-0.8.7...
Building YARD (yri) index for irbtools-0.8.7...
Installing RDoc documentation for irbtools-0.8.7...

$ gem1.9.1 which irbtools  # yup, installed OK
/var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/irbtools.rb

$ ls /var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/
irbtools  irbtools.rb

$ ruby1.9.1 -e 'require "irbtools"'
<internal:lib/rubygems/custom_require>:33:in `require': no such file to load -- irbtools (LoadError)
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from -e:1:in `<main>'

It doesn't work in irb1.9.1 either. All other gems in /var/lib/gems/1.9.1/gem seem to be working fine. Now I'm kinda dumbstruck.

Can anyone please help me track down what's going on? I'm not necessarily looking for a solution, but just an idea what to do to debug the problem.

I'm on Debian Squeeze with

$ ruby1.9.1 --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i486-linux]

回答1:


This error is quite strange... I haven't got a debian here, but a generic solution would be to use rvm or build ruby from source.

Hints for debugging the problem:

  • Does requiering or loading /var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/irbtools.rb directly work?
  • Do your ruby binary and your gem binary really refer to the same installation?
  • Can irbtools be found with the Gem.source_index method?: Gem.source_index.gems.keys.grep /irbtools/


来源:https://stackoverflow.com/questions/5541059/ruby-require-irbtools-raises-loaderror

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!