Gems gone due to bad $:

On an Ubuntu box.

I have been experimenting with ruby1.9 and now I am finding that gems
are gone from 1.8. It seems by RUBYLIB path is never modified.

I don’t know if that had anything to do with it or an update of the OS
screwed up something.

$ ls /usr/lib/ruby/gems/1.8/
gems/
(all gems are listed)

$ type ruby
ruby is /usr/bin/ruby

$ ls -l /usr/bin/ruby
lrwxrwxrwx 1 root root 7 2007-04-23 07:58 /usr/bin/ruby -> ruby1.8

$ type irb1.8
/usr/bin/irb1.8

$ head -n1 /usr/bin/irb1.8
#!/usr/bin/ruby1.8

$ /usr/bin/ruby1.8 --version
ruby 1.8.6 (2007-06-07 patchlevel 36) [x86_64-linux]

$ export RUBYOPT=’-w -rubygems’

$ irb1.8

irb> $:
=> ["/home/gga/ruby/libs", “/home/gga/ruby/libs”, “/usr/local/lib/
site_ruby/1.8”, “/usr/local/lib/site_ruby/1.8/x86_64-linux”, “/usr/
local/lib/site_ruby”, “/usr/lib/ruby/1.8”, “/usr/lib/ruby/1.8/x86_64-
linux”, “.”]

irb> require ‘rubygems’
=> false

irb> require ‘rails’
LoadError: no such file to load – rails

$ gem --version
0.9.4

Can anyone help me revert back to a working rubygems?

gga wrote:

(all gems are listed)
$ head -n1 /usr/bin/irb1.8
irb> $:

$ gem --version
0.9.4

Can anyone help me revert back to a working rubygems?

On my ubuntu box when installing gems using the package manager, the
default path for gems is under /var/lib/gems

3.3 No such file to load – rubygems

When I run the gem command, I get the following error message:

ruby: No such file to load – rubygems (LoadError)

What’s wrong?
Answer

It looks like executing copy of Ruby does not have the RubyGems library
installed. RubyGems was probably installed at one time (because the gem
command is recognized), but it may have been installed on a different
installation of Ruby than the one you are currently running.
Things to check

* Check that the installation of Ruby that is running is the same 

one that has RubyGems installed. On a unix system, the which command (or
type command) will help figure this out.

* Verify that the currently running installation of Ruby does indeed 

have the RubyGems library installed. You should find a “rubygems.rb”
file in the site_ruby/1.8 directory of the Ruby installation.

These mixup can easily happen after installing a new instance of Ruby,
but the old instance preceeds the new one in the PATH list.

http://rubygems.org/read/chapter/19

Usually uninstalling all packages and installing them again (except 1.9
pkg) fix things.

On Jan 8, 2008, at 21:55 , gga wrote:

irb> require ‘rubygems’
=> false

irb> require ‘rails’
LoadError: no such file to load – rails

Expected behavior:

% gem list rails; ruby -v -e ‘require “rubygems”; require “rails”’

*** LOCAL GEMS ***

rails (1.2.6)

ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- rails (LoadError) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:inrequire’
from -e:1

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs