Forum: Ruby Gems (1.3.0) not visible from ruby (1.8.7)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A5f9051583f414c1e1b5d76c21914dff?d=identicon&s=25 Joni Niemi (jniemi)
on 2008-10-20 16:50
Hi,

I'm trying to sftp into another server using net-sftp, but the gems I
install are not visible to ruby interpreter.

I've installed the net-sftp gem, and it shows fine in gem listing (see
below), but when I try to run a script, the library is not found (see
below).

Any help would be highly appreciated!

Cheers, Joni
--
E.g. my script file begins with:

require 'net/sftp'

>gem list

*** LOCAL GEMS ***

builder (2.1.2)
linecache (0.43)
net-scp (1.0.1)
net-sftp (2.0.1)
net-ssh (2.0.4)
net-ssh-gateway (1.0.0)
net-ssh-multi (1.0.0)
ruby-debug-base (0.10.2, 0.10.0)
rubygems-update (1.3.0)

>ruby myscript.rb
myscript.rb:1:in `require': no such file to load -- net/sftp (Loa
dError)
        from myscript.rb:1

>gem environment
D:\dev\engineerize\Reaper\lib>d:\ruby\ruby1.8.7\bin\gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.0
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]
  - INSTALLATION DIRECTORY: D:/ruby/ruby1.8.7/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: D:/ruby/ruby1.8.7/bin/ruby.exe
  - EXECUTABLE DIRECTORY: D:/ruby/ruby1.8.7/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mswin32-60
  - GEM PATHS:
     - D:/ruby/ruby1.8.7/lib/ruby/gems/1.8
     - D:/MyDocuments/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2008-10-20 18:08
(Received via mailing list)
On Mon, Oct 20, 2008 at 10:49 AM, Joni Niemi <joni.niemi@vtt.fi> wrote:
>
> Cheers, Joni
> --
> E.g. my script file begins with:
>
> require 'net/sftp'

It should begin with

require "rubygems"
851acbab08553d1f7aa3eecad17f6aa9?d=identicon&s=25 Ken Bloom (Guest)
on 2008-10-20 18:44
(Received via mailing list)
On Mon, 20 Oct 2008 09:49:04 -0500, Joni Niemi wrote:

>
> builder (2.1.2)
> myscript.rb:1:in `require': no such file to load -- net/sftp (Loa
> dError)
>         from myscript.rb:1

You need to
require 'rubygems'
first.

--Ken
A5f9051583f414c1e1b5d76c21914dff?d=identicon&s=25 Joni Niemi (jniemi)
on 2008-10-21 08:35
Thanks, Ken and Gregory, that worked like a dream! I somehow missed the
bit in the docs...

Cheers,

Joni
n00b :-)
This topic is locked and can not be replied to.