cannot load installed gems

Z

ZHANG Yin

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~~~~
 
Z

ZHANG Yin

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?
 
E

Eric Hodel

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.

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?
 
Z

ZHANG Yin

Eric said:
ri Hpricot

Oh! I see, ri Hpricot works.
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:
- http://gems.rubyforge.org

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~~
 
T

Todd Benson

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?

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
 
Z

ZHANG Yin

Todd said:
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top