views:

112

answers:

2

I know there's similar questions on SO, but none of them solve my problem... The gist of it is that I can't get gems to load on a clean Ruby 1.9.1 install on Ubuntu 10.04:

:~/$ irb
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'cassandra'
LoadError: no such file to load -- cassandra
    from (irb):1:in 'require'
    from (irb):1
    from /usr/local/bin/irb:12:in '<main>'
irb(main):003:0> Gem.path

=> ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
irb(main):004:0> exit

:~/$ ls /opt/ruby1.9/lib/ruby/gems/1.9.1/gems/
cassandra-0.8.2  eventmachine-0.12.10  json-1.4.6  rake-0.8.7  simple_uuid-0.1.1  thrift-0.2.0.4  thrift-0.4.0  thrift_client-0.5.0

:~/$ gem list --local

*** LOCAL GEMS ***

cassandra (0.8.2)
eventmachine (0.12.10)
json (1.4.6)
rake (0.8.7)
simple_uuid (0.1.1)
thrift (0.4.0, 0.2.0.4)
thrift_client (0.5.0)

:~/$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
  - INSTALLATION DIRECTORY: /opt/ruby1.9/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /opt/ruby1.9/bin/ruby1.9
  - EXECUTABLE DIRECTORY: /opt/ruby1.9/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /opt/ruby1.9/lib/ruby/gems/1.9.1
     - /home/mark/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Any ideas? Thanks in advance...

+2  A: 

Your gem env and Gem.path are inconsistent.


Your Gem.path is looking at ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"] but your gem env is looking at /opt/ruby1.9/lib/ruby/gems/1.9.1

As a quick check, why not create a symlink from /opt/ruby1.9/lib/ruby/gems/1.9.1 to /opt/ruby1.9/lib/ruby1.9/gems/1.9.1 to /opt/ruby1.9/lib/ruby/gems/1.9.1

sudo ln -s /opt/ruby1.9/lib/ruby1.9/gems/1.9.1  /opt/ruby1.9/lib/ruby/gems/1.9.1
Chris McCauley
Thank you! I knew another pair of eyes would help!
Mark
+1  A: 

Also check access rights for all directories. The Ruby machine should be able to read them all.

Lavir the Whiolet