ここに文書化されています。
概要
Ruby1.8ではRubyクラスの実行はOKです。 しかし、Ruby 構成を更新してインタープリタを変更しようとすると、次のようになります。
sudo update-alternatives –config Ruby
Ruby1.9 を選択すると、Ruby クラスを実行するたびにこのエラーが発生します。
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:
in `require': cannot load such file -- cassandra (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
クラスcustom_require.rbの一部は次のとおりです。
module Kernel
if defined?(gem_original_require) then
# Ruby ships with a custom_require, override its require
remove_method :require
else
##
# The Kernel#require from before RubyGems was loaded.
alias gem_original_require require
private :gem_original_require
end
def require path
if Gem.unresolved_deps.empty? or Gem.loaded_path? path then
#!!!!!line 36 !!!!!:
gem_original_require path
else
spec = Gem::Specification.find { |s|
s.activated? and s.contains_requirable_file? path
}
RVM を使用すると問題が解決する可能性があると読みましたが、実際にはそれを管理する方法がわかりません。
アイデアを教えてください。
解決策
Rubygem は Ruby のバージョンによって分けられているため、Cassandra gem を再インストールする必要があります。
gem install cassandra
gem が 1.9 gem を指していることを確認してください。
これを行う必要がある主な理由は、1.9 ライブラリに対して C 拡張機能を再構築するためです。