cannot require rubygems, perhaps because of multiple ruby versions? -


i cannot require rubygems in ruby files: (although can require other modules - such rexml/document)

my 01.rb file:

require "rubygems" 

when execute ruby 01.rb, got:

01.rb:1:in `require': no such file load -- rubygems (loaderror)     01.rb:1 

however output of commands on system:
my ruby version (i think have multiples, causes problem, right? - should remove , re-install scratch?)

mhewedy@compu10:~$ ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]  mhewedy@compu10:~$ -a ruby /usr/bin/ruby  mhewedy@compu10:~$ ls -lt /usr/bin/ruby lrwxrwxrwx 1 root root 22 sep 11 07:28 /usr/bin/ruby -> /etc/alternatives/ruby  mhewedy@compu10:~$ ls -lt /etc/alternatives/ruby lrwxrwxrwx 1 root root 16 sep 27 10:00 /etc/alternatives/ruby -> /usr/bin/ruby1.8  mhewedy@compu10:~$ ls /usr/bin/ruby* /usr/bin/ruby  /usr/bin/ruby1.8  /usr/bin/ruby1.9.1  /usr/bin/ruby1.9.3 

and here's gem env

gem env rubygems environment:   - rubygems version: 1.8.11   - ruby version: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]   - installation directory: /var/lib/gems/1.9.1   - ruby executable: /usr/bin/ruby1.9.1   - executable directory: /usr/local/bin   - rubygems platforms:     - ruby     - x86_64-linux   - gem paths:      - /var/lib/gems/1.9.1      - /home/mhewedy/.gem/ruby/1.9.1   - gem configuration:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000   - remote sources:      - http://rubygems.org/ 

i fix this making system-wide ruby version (the 1 results which ruby, /usr/bin/ruby) point same 1 in output of gen env - 1.9.1.

i did -on ubuntu box- using:

sudo update-alternatives --config ruby

then chosen version matches 1 in output of gem env


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -