我知道在SO上有类似的问题,但没有一个能解决我的问题...它的要点是我无法在Ubuntu 10.04上安装干净的Ruby 1.9.1上加载宝石:
:~/$ 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/
有什么想法吗?提前谢谢......
答案 0 :(得分:2)
您的Gem.path正在查看["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
,但您的宝石环境正在查看/opt/ruby1.9/lib/ruby/gems/1.9.1
作为快速检查,为什么不从/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
答案 1 :(得分:2)
还要检查所有目录的访问权限。 Ruby机器应该能够全部读取它们。