I am having problem with setting PATH variable in Ruby on Rails. Constraints are: I have to use Ruby 1.8.7 and Rails 2.2.2 and Rubygems 1.3.5. These are the outputs of commands:
hemant@hemant-laptop:~$ which gem
/usr/bin/gem
hemant@hemant-laptop:~$ which ruby
/usr/local/bin/ruby
hemant@hemant-laptop:~$ which rails
/var/lib/gems/1.8/bin/rails
hemant@hemant-laptop:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/hemant/.gem/ruby/1.8
I have added these lines into my .bashrc
file:
export PATH=$PATH:/var/lib/gems/1.8/bin
export PATH=$PATH:/usr/bin/gem
When I echo PATH variable:
hemant@hemant-laptop:~$ echo $PATH
usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:bin:/usr/games:/var/lib/gems/1.8/bin:/usr/bin/gem
Real problem is that when I run script/server
in my rails app directory, It errors:
./script/../config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1:in 'require': no such file to load -- rubygems (LoadError)
When I googled it, I got to know that it is due to flaw in PATH
variable configuration, but I can't understand what value I should give to it. The above two export
statements are just hit and trials but they didn't solve the problem.
Can someone please guide me what value PATH
must be set to and how one can deduce the value from outputs of various commands.
[EDIT]
Running gem list
gives this:
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
chronic (0.10.2)
diff-lcs (1.2.4)
image_science (1.2.1)
libv8 (3.16.14.3)
mysql (2.9.1)
rack (1.5.2)
rails (2.2.2)
rake (0.8.7)
ref (1.0.5)
rspec (1.2.9)
rspec-core (2.14.6)
rspec-expectations (2.14.0)
rspec-mocks (2.14.4)
rspec-rails (1.2.9)
rubygems-update (2.1.10)
therubyracer (0.12.0)
ZenTest (4.3.0)