Cannot load installed gems

Hello there.

Well, I’ve installed hpricot using gem, and it works well in windows.
But under my fedora 7, although gem told me that hpricot has been
successfully installed(I did install gcc and make so that gem can
compile the source code), I still can’t load it into my program. Under
irb, it just told me that ‘no such file to load hpricot’ when I type
“require ‘hpricot’”.

I’ve also installed rails using gem under Linux. If I type ‘rails -v’
directly into the terminal, it works and told me it’s ‘rails 1.2.3’, but
“require ‘rails’”(I don’t know whether it’ll work. Just to have a try)
in irb won’t work too, just like hpricot.

“ri hpricot” won’t work too.

I can find hpricot and rails under ‘/usr/lib/ruby/gems/1.8/gems’. But it
seems the ruby won’t load libs in it.

What should I do~~~~

I’ve searched the forum and found one solution.

require ‘rubygems’
require ‘hpricot’

It works, but seems a bit…

Under windows, a single “require ‘hpricot’” will work, and I think it’ll
work under fedora 7 too.

Are there any solutions?

On Jun 5, 2007, at 18:53, ZHANG Yin wrote:

“require ‘rails’”(I don’t know whether it’ll work. Just to have a try)
in irb won’t work too, just like hpricot.

“ri hpricot” won’t work too.

ri Hpricot

I can find hpricot and rails under ‘/usr/lib/ruby/gems/1.8/gems’.
But it
seems the ruby won’t load libs in it.

What does gem env say?

What does gem list say?

On Jun 6, 2007, at 00:24, ZHANG Yin wrote:

Oh! I see, ri Hpricot works.

Then you probably forgot to require ‘rubygems’ before require ‘hpricot’.

Eric H. wrote:

On Jun 5, 2007, at 18:53, ZHANG Yin wrote:

“require ‘rails’”(I don’t know whether it’ll work. Just to have a try)
in irb won’t work too, just like hpricot.

“ri hpricot” won’t work too.

ri Hpricot

Oh! I see, ri Hpricot works.

I can find hpricot and rails under ‘/usr/lib/ruby/gems/1.8/gems’.
But it
seems the ruby won’t load libs in it.

What does gem env say?

What does gem list say?

gem env:

RubyGems Environment:

  • VERSION: 0.9.2 (0.9.2)
  • INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  • GEM PATH:
    • /usr/lib/ruby/gems/1.8
  • REMOTE SOURCES:

gem list:

*** LOCAL GEMS ***

actionmailer (1.3.3)
Service layer for easy email delivery and testing.

actionpack (1.13.3)
Web-flow and rendering framework putting the VC in MVC.

actionwebservice (1.2.3)
Web service support for Action Pack.

activerecord (1.15.3)
Implements the ActiveRecord pattern for ORM.

activesupport (1.4.2)
Support and utility classes used by the Rails framework.

hpricot (0.5.145)
a swift, liberal HTML parser with a fantastic library

rails (1.2.3)
Web-application framework with template engine, control-flow layer,
and ORM.

rake (0.7.3)
Ruby based make-like utility.

sources (0.0.1)
This package provides download sources for remote gem installation

but “require ‘hpricot’” won’t work~~

On 6/5/07, ZHANG Yin [email protected] wrote:

Are there any solutions?
When you installed under windows, most likely you selected the option
in the one-click installer that says “Enable rubygems”.

You can make Fedora act the same (untested) by setting your
environment to use RUBYOPT:

export RUBYOPT=-rrubygems

hth,
Todd

Todd B. wrote:

On 6/5/07, ZHANG Yin [email protected] wrote:

Are there any solutions?
When you installed under windows, most likely you selected the option
in the one-click installer that says “Enable rubygems”.

You can make Fedora act the same (untested) by setting your
environment to use RUBYOPT:

export RUBYOPT=-rrubygems

hth,
Todd

Well, that’s great! Thanks a lot!