ruby1.9.1 can't find installed gems, yet ruby1.8 can
On ubuntu here. I installed both ruby1.8 and ruby1.9.1. I also ran these commands
ruby1.8 setup.rb
ruby1.9.1 setup.rb
Both worked fine, I was also able to install gems for both. The gems in gem 1.9.1 and gem1.8 both show up correctly for gem list
. The problems however begin with this: ruby1.9.1 some_script.rb
. It cannot find any of the gems. I tried uncommenting some out figuring that parseconfig was the problem, yet it couldn't find any of the other开发者_C百科s, which are definetly in gem1.9.1 list
. Any thoughts as to what is causing this/how to recover?
edit/side note: ruby1.9.1 won't be able to find the gems in 1.8 either. Not that I want that! Just clarifying
From pejuko's answer!:
cd /var/lib/
cd gems
bash: cd: gems: No such file or directory
sudo ln -s /usr/lib/ruby/gems
irb1.9.1
irb(main):001:0> require 'mechanize'
=> true
This fixed it! Also, screw debian.
I don't know if this is the case, but when I installed rubygems from rubyforge I needed to create some symlinks because ubuntu uses different directory for gems then the original one. I have in directory /usr/lib/ruby/ gems symlinked to /var/lib/gems/
you probably need to add a require 'rubygems'
to the top of your scripts. this will instruct ruby to load up the gem system and you'll then be able to find all of your gems from the ruby 1.9.1 runtime.
精彩评论