Forum: Ruby ...rubygems... in require: no such file to load

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.
wybo (Guest)
on 2005-12-08 15:42
(Received via mailing list)
I have a script requiring rubygems, rio, and more, plus a module in a
non-standard directory. It  works fine on my machine, but not on the
machine of a friend.

Here's the important part of my module
    require 'session'
    require 'rubygems'
    require 'term/ansicolor'

    class String
      include Term::ANSIColor
    end

    module TestMe
      def sys(command)
        ...
      end
    end # TestMe

It is stored in /home/local/ruby/testme.rb
And this is the calling script:

    #!/usr/bin/ruby
    puts 'LOAD_PATH:',$LOAD_PATH.join("\n")
    puts 'RUBYLIB:',ENV['RUBYLIB']
    puts 'RUBYOPT:',ENV['RUBYOPT']

    require 'rubygems'
    require 'rio'
    require 'testme'
    include TestMe
    sys('ls')

    puts rio('/etc/passwd').gets

On my machine it successfully says:

    tmp>testme
    LOAD_PATH:
    .
    /home/local/ruby
    /usr/local/lib/ruby/site_ruby/1.8
    /usr/local/lib/ruby/site_ruby/1.8/i686-linux
    /usr/local/lib/ruby/site_ruby
    /usr/local/lib/ruby/1.8
    /usr/local/lib/ruby/1.8/i686-linux
    .
    RUBYLIB:
    .:/home/local/ruby
    RUBYOPT:
    nil
    system call: ls successful
    root:x:0:0:root:/home/root:/bin/bash
    tmp>

But on the friend's machine (who stores the module in
/home/rrt/local/lib/site_ruby/1.8):

    tmp>testme
    LOAD_PATH:
    /home/rrt/local/lib/site_ruby/1.8/i386-linux
    /home/rrt/local/lib/site_ruby/1.8
    /usr/local/lib/site_ruby/1.8
    /usr/local/lib/site_ruby/1.8/i386-linux
    /usr/local/lib/site_ruby
    /usr/lib/ruby/1.8
    /usr/lib/ruby/1.8/i386-linux
    .
    RUBYLIB:
    /home/rrt/local/lib/site_ruby/1.8/i386-linux:/home/rrt/local/lib/site_ruby/1.8
    RUBYOPT:
    nil
    /usr/lib/ruby/1.8/rubygems/custom_require.rb:26:in `require': No
such file
    to load -- testme (LoadError)
    from ./testme:8

What's wrong? Something with the rubygems installation?
Jim W. (Guest)
on 2005-12-08 17:58
wybo wrote:
> I have a script requiring rubygems, rio, and more, plus a module in a
> non-standard directory. It  works fine on my machine, but not on the
> machine of a friend.
>
[...]
>     /usr/lib/ruby/1.8/rubygems/custom_require.rb:26:in `require': No
> such file
>     to load -- testme (LoadError)
>     from ./testme:8
>
> What's wrong? Something with the rubygems installation?

(1) Double check that testme is truely installed in the
/home/rrt/local/lib/site_ruby/1.8.

(2) Make sure the file can be loaded correctly.

Try soemthing like this to see if it sheds any light:

   load '/home/rrt/local/lib/site_ruby/1.8/testme.rb'

-- Jim W.
wybo (Guest)
on 2005-12-10 12:04
(Received via mailing list)
On Fri, 9 Dec 2005, Jim W. wrote:

> >
> > What's wrong? Something with the rubygems installation?
>
> (1) Double check that testme is truely installed in the
> /home/rrt/local/lib/site_ruby/1.8.
>
> (2) Make sure the file can be loaded correctly.
>
> Try soemthing like this to see if it sheds any light:
>
>    load '/home/rrt/local/lib/site_ruby/1.8/testme.rb'

Thanks, Jim. This helped: we finally found out that the session gem
wasn't
installed, but another session.rb was loaded instead.
This topic is locked and can not be replied to.