Ruby can't find installed gems

C

Chet Farmer

I've been fighting this all day, and I can't grok where I've gone wrong.
I hope someone here can help.

I'm trying to write a fairly simple script to handle some periodic SFTP
file submissions to a client's vendor. Net::SFTP seems like just the
ticket!

My code, then, has

require 'net/ssh'
require 'net/sftp'

in it, but every attempt to run gets this:

$ /usr/bin/ruby xm.rb
xm.rb:21:in `require': no such file to load -- net/ssh (LoadError)

I've tried this with the out-of-the-box ruby install (1.8.3) on my
PowerBook (Tiger); a customized install I found instructions for on the
Rails site on the grounds that the OS X ruby is "broken"; and on my
Ubuntu box. On Ubuntu, I tried with the packaged 1.8.3 as well as a
hand-compiled 1.8.4 based on a thread from earlier this month. Since I'm
having essentially the same problem on two different platforms, it's
clearly something silly I've done, but I don't know what. (Oh, and irb
fails the same way on the require lines.)

I'm new to ruby, obviously, and quite keen to get started, but I really
don't know where to go next. I don't even know how to properly
interrogate ruby about its environment (sort of a ruby equivalent of
"perl -V").

Help!

Thanks in advance...
 
E

Eero Saynatkari

Chet said:
I've been fighting this all day, and I can't grok where I've gone wrong.
I hope someone here can help.

I'm trying to write a fairly simple script to handle some periodic SFTP
file submissions to a client's vendor. Net::SFTP seems like just the
ticket!

My code, then, has

# It might be missing this if these are through Gems
require 'rubygems'
 
S

Steven R.

Chet said:
I've been fighting this all day, and I can't grok where I've gone wrong.
I hope someone here can help.

I'm trying to write a fairly simple script to handle some periodic SFTP
file submissions to a client's vendor. Net::SFTP seems like just the
ticket!

My code, then, has

require 'net/ssh'
require 'net/sftp'

in it, but every attempt to run gets this:

$ /usr/bin/ruby xm.rb
xm.rb:21:in `require': no such file to load -- net/ssh (LoadError)

I've tried this with the out-of-the-box ruby install (1.8.3) on my
PowerBook (Tiger); a customized install I found instructions for on the
Rails site on the grounds that the OS X ruby is "broken"; and on my
Ubuntu box. On Ubuntu, I tried with the packaged 1.8.3 as well as a
hand-compiled 1.8.4 based on a thread from earlier this month. Since I'm
having essentially the same problem on two different platforms, it's
clearly something silly I've done, but I don't know what. (Oh, and irb
fails the same way on the require lines.)

I'm new to ruby, obviously, and quite keen to get started, but I really
don't know where to go next. I don't even know how to properly
interrogate ruby about its environment (sort of a ruby equivalent of
"perl -V").

Help!

Thanks in advance...

First, try this:

prompt$ irb -rrbconfig
irb(main):002:0> Config::CONFIG["gems"]
irb(main):003:0> Config::CONFIG["site_ruby"]

If you get 'nil' you probably have an issue with your install - the gems
are there, but the required system variables are not set, or your PATH
is incomplete. You can include the entire path in your require line, but
that is an inelegant solution - but it will work if you are at the
hair-pulling stage and are waiting for a more advanced user to help.

Obviously, I am still getting my installation up and running too - but
the above solution worked for me 'for the time being'.

In case you haven't seen this before - here's an amazing resource for
your setup (based on your description).

http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger

You can skip the LightTPD if you like - the section on installing Ruby
and Rails on Tiger is excellent on its' own.

Good luck!
 
C

Chet Farmer

Eero said:
# It might be missing this if these are through Gems
require 'rubygems'


That does appear to be at least part of my "something stupid n00b error"
issue. By doing that, my error goes away and all is well on OS X, but
I've still sustained brokenness on Ubuntu. Now it's complaining of
openssl issues, but I suspect my endless recompilations of ruby today
have left the machine somewhat confused. I'll reboot and reimage it
tomorrow and start from there now that I know a bit more.

Thanks for the quick reply. Best,

chet
Houston
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top