Ruby 1.9.3 非常简单的代码和我无法处理的非常简单的问题:
gem list --local
nokogiri (1.5.5)
gem q --local
nokogiri (1.5.5)
但是一个红宝石脚本(不是Rails):
require 'nokogiri'
doc = Nokogiri.XML("some valid xml....")
给我
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- nokogiri (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/alex/test.rb:3:in `<main>'
[Finished in 0.1s with exit code 1]
我知道没有必要使用require 'rubygems'
,但即使我这样做,它也不起作用。
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/alex/.rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /home/alex/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/alex/.rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/alex/.rvm/gems/ruby-1.9.3-p194
- /home/alex/.rvm/gems/ruby-1.9.3-p194@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
gem which nokogiri
/home/alex/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/lib/nokogiri.rb