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:inrequire’
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.
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
On Tue, Nov 20, 2012 at 10:02 AM, johnny mo [email protected]
wrote:
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?
$ 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
On Tue, Nov 20, 2012 at 10:23 AM, johnny mo [email protected]
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.
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.