我知道这已经完成了死亡,似乎有关于这个问题的十几个问题,但我只是找不到合适的答案。
我正在使用RVM来管理我的红宝石,但我没有使用任何自定义gemsets。我做了一个gem install passivedns-client
,安装时没有给我任何错误。但是我无法在任何脚本甚至是irb中加载gem。以下是可能提供上下文的一些命令的输出。
Machine_name:~ user_name$ gem list passive
*** LOCAL GEMS ***
passivedns-client (1.4.1)
Machine_name:~ user_name$ rvm gemdir
/Users/user_name/.rvm/gems/ruby-2.1.3
Machine_name:~ user_name$ which irb
/Users/user_name/.rvm/rubies/ruby-2.1.3/bin/irb
Machine_name:~ user_name$ which gem
/Users/user_name/.rvm/rubies/ruby-2.1.3/bin/gem
Machine_name:~ user_name$ irb
2.1.3 :001 > $LOAD_PATH
=> ["/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/x86_64-darwin13.0", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/vendor_ruby/2.1.0", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/vendor_ruby/2.1.0/x86_64-darwin13.0", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/vendor_ruby", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0", "/Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/x86_64-darwin13.0"]
2.1.3 :002 > require 'passivedns-client'
LoadError: cannot load such file -- passivedns-client
from /Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/user_name/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from (irb):2
from /Users/user_name/.rvm/rubies/ruby-2.1.3/bin/irb:11:in `<main>'
2.1.3 :003 >
Machine_name:~ user_name$ rvm current
ruby-2.1.3
答案 0 :(得分:0)
我认为这个特定宝石的命名空间是错误的,而不是你的$LOAD_PATH
。我使用bundle open
对其进行了诊断,但经过几次尝试后,我能够通过以下方式进行诊断:
[1] pry(main)> require 'passivedns'
LoadError: cannot load such file -- passivedns
from /Users/anthonyross/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
[2] pry(main)> require 'passivedns/client/version'
=> true
[3] pry(main)> c = PassiveDNS::Client.new
=> #<PassiveDNS::Client:0x007f8e0e83b820>
[4] pry(main)>