How can I use Nokogiri in irb?

I'm trying to:

require 'nokogiri'

in irb, without success. Nokogiri stone is installed. From:

gem list --local

I get:

nokogiri (1.4.4, 1.4.3.1)

but when I try to “require” it in irb, I get:

LoadError: there is no such file to load - nokogiri from (irb): 8: in `require 'from (irb): 8 from: 0

Nokigiri lives in:

/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/nokogiri-1.4.4/lib

on my system. Also, my GEM PATH (from gem env):

/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8

If I go all the way to the nokogiri gem directory, I can successfully “require” it. But why can't I demand it anywhere? I misunderstand something about the way gems.

+3
source share
2 answers

Try require 'rubygems'before calling nokogiri. If your machine has no witches, this may help.

+6

Ruby 1.9 require 'rubygems' . Post 1.9. , 1.8.7, -, irb.

require 'rubygems' ~/.irbrc , . , .

+3

Source: https://habr.com/ru/post/1780015/


All Articles