Some gems not working anymore

hi,

I have a very strange issue. Some of my installed gems are not working
anymore. For example:

$ ruby -rrack/test -e 1
/home/jacky/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- rack/test (LoadError)
  from
/home/jacky/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'

Which is strange because:

$ gem which rack/test
/home/jacky/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/test.rb

So clearly the gem executable can see the gem, but ruby cannot. This is
not the only gem not working anymore, but some gems do work. I tried
reinstalling to no avail. File permissions look OK. Ruby version is
1.9.3 (under rvm as you can see above) and gem is 1.8.24. OS is Ubuntu
10.04.

Any ideas on how to resolve this?

···

--
Posted via http://www.ruby-forum.com/.

Odd, I'd verify your using the same gem that came with your build of
ruby.

i.e. run these commands
which gem
which ruby

Make sure there from the same install(nominally that would be the same
directory). You could be grabbing a ruby install from something else,
and a gem binary a different source

···

--
Posted via http://www.ruby-forum.com/.

hi,

Thanks for looking into this.

$ which ruby
/home/jacky/.rvm/bin/ruby
$ which gem
/usr/bin/gem
$ ls -l /usr/bin/gem
/usr/bin/gem -> /home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/gem

So I changed the softlink /usr/bin/gem to point to
/home/jacky/.rvm/bin/gem
Unfortunately, the problem stayed the same. But that's not surprising
given that the content of /home/jacky/.rvm/bin/gem is:
#!/usr/bin/env bash

if [[ -s "/home/jacky/.rvm/environments/ruby-1.9.3-p194" ]]
then
  source "/home/jacky/.rvm/environments/ruby-1.9.3-p194"
  exec gem "$@"
else
  echo "ERROR: Missing RVM environment file:
'/home/jacky/.rvm/environments/ruby-1.9.3-p194'" >&2
  exit 1
fi

Any other ideas?

···

--
Posted via http://www.ruby-forum.com/.

This is Ubuntu 10.04.

What happened was that I installed ruby 1.8.7 a long time ago. After a
few months I installed rvm (which was previously missing) and ruby 1.9.3
and subsequently removed 1.8.7. That's why /usr/bin/gem exists. I've now
removed it. No change to the situation though.

···

--
Posted via http://www.ruby-forum.com/.

I think you got it!

$ which ruby
/home/jacky/.rvm/bin/ruby

$gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
  - INSTALLATION DIRECTORY: /home/jacky/.rvm/gems/ruby-1.9.3-p194
  - RUBY EXECUTABLE: /home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jacky/.rvm/gems/ruby-1.9.3-p194/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/jacky/.rvm/gems/ruby-1.9.3-p194
     - /home/jacky/.rvm/gems/ruby-1.9.3-p194@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Now the question is which ruby executable should I choose and what would
be the best way of pointing the system to it?

···

--
Posted via http://www.ruby-forum.com/.

But something's strange, they're both exactly the same:

$/home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
jacky@jacky:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

···

--
Posted via http://www.ruby-forum.com/.

Aha! You're right, reinstalling rvm helped. Thanks very much for your
help Robert.

···

--
Posted via http://www.ruby-forum.com/.

hi,

Thanks for looking into this.

$ which ruby
/home/jacky/.rvm/bin/ruby
$ which gem
/usr/bin/gem

This looks suspicious: why do you have a /usr/bin/gem but not a /usr/bin/ruby?

$ ls -l /usr/bin/gem
/usr/bin/gem -> /home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/gem

So I changed the softlink /usr/bin/gem to point to
/home/jacky/.rvm/bin/gem

I'd probably rather remove /usr/bin/gem completely. Somehow you seem
to be mixing installations. What OS and distribution is this and what
did you do to install ruby?

Cheers

robert

···

On Tue, Nov 20, 2012 at 10:02 AM, johnny mo <lists@ruby-forum.com> wrote:

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Hm.... Did you check "gem environment"?

Cheers

robert

···

On Tue, Nov 20, 2012 at 10:23 AM, johnny mo <lists@ruby-forum.com> wrote:

This is Ubuntu 10.04.

What happened was that I installed ruby 1.8.7 a long time ago. After a
few months I installed rvm (which was previously missing) and ruby 1.9.3
and subsequently removed 1.8.7. That's why /usr/bin/gem exists. I've now
removed it. No change to the situation though.

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

That should be decided by rvm. Maybe you need to reinstall now that
you removed the remainders of the old installation.

Kind regards

robert

···

On Tue, Nov 20, 2012 at 11:24 AM, johnny mo <lists@ruby-forum.com> wrote:

I think you got it!

$ which ruby
/home/jacky/.rvm/bin/ruby

$gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
  - INSTALLATION DIRECTORY: /home/jacky/.rvm/gems/ruby-1.9.3-p194
  - RUBY EXECUTABLE: /home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jacky/.rvm/gems/ruby-1.9.3-p194/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/jacky/.rvm/gems/ruby-1.9.3-p194
     - /home/jacky/.rvm/gems/ruby-1.9.3-p194@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Now the question is which ruby executable should I choose and what would
be the best way of pointing the system to it?

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Did you reinstall? Does the original error still show?

Cheers

robert

···

On Tue, Nov 20, 2012 at 11:41 AM, johnny mo <lists@ruby-forum.com> wrote:

But something's strange, they're both exactly the same:

$/home/jacky/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
jacky@jacky:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/