Ruby gem install and "There is no such file to download"

I am working with Ruby 1.9.2dev in Backtrack 5, but I am having some problems trying to parse html objects using the htmlentities library.

I cannot load the library, although I installed it using gem. I will show you the problems that I have in the console:

root@bt:~# gem list -d htmlentities

*** LOCAL GEMS ***

htmlentities (4.3.1)
    Author: Paul Battley
    Homepage: https://github.com/threedaymonk/htmlentities
    Installed at: /var/lib/gems/1.9.2

    A module for encoding and decoding (X)HTML entities.

root@bt:~# irb  irb(main):001:0> require 'htmlentities'  LoadError: no such file to load -- htmlentities    
       from (irb):1:in `require'    
       from (irb):1     
       from /usr/bin/irb:12:in `<main>'

This is the same problem that I have with nokogiri. I installed the library using

gem install htmlentities

Do you have an idea why I have such a problem?

Thank.

Edition:

I also tried with the requirement "rubygems" earlier on any other requirement, but the same thing happens:

I tried "rubygems" but the exact same thing happens:

irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'htmlentities'
LoadError: no such file to load -- htmlentities
    from (irb):2:in `require'
    from (irb):2
    from /usr/bin/irb:12:in `<main>'
+5
source share
2 answers

require 'rubygems' .

rubygems Kernel#require gempath. Whitout it ruby ​​ / .

+20

, , . GEM_PATH.

# echo "export GEM_PATH=/var/lib/gems/1.9.2/" >> ~/.bashrc 
# source ~/.bashrc

, irb:

# irb 
irb(main):003:0> require 'htmlentities'
=> true
irb(main):004:0>

Woot!

+3

All Articles