tags:

views:

865

answers:

2

Hello,

I recently installed rails in fedora 12. I'm new to linux as well. Everything works fine on Windows 7. But I'm facing lot of problems in linux. Help please!

I've installed all the essentials to my knowledge to get the basic script/server up and running. I have this error from boot.rb popping up when I try script/server. Some of the details I'd like to give here:

The directories where rails, ruby and gem are installed,

[vineeth@localhost my_app]$ which ruby
/usr/local/bin/ruby

[vineeth@localhost my_app]$ which rails
/usr/bin/rails

[vineeth@localhost my_app]$ which gem
/usr/bin/gem

And when I run the script/server, this is the error.

[vineeth@localhost my_app]$ script/server
./script/../config/boot.rb:9:in `require': no such file to load -- rubygems (LoadError)
 from ./script/../config/boot.rb:9
 from script/server:2:in `require'
 from script/server:2

And the PATH file looks like this

[vineeth@localhost my_app]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin/ruby:$PATH"

I suppose it is something to do with the PATH file. Let me know what I need to change here. If there are other changes I should make, please let me know, Thanks

A: 

I have a hunch that you have two ruby versions. Please paste the output of following command:

$ which -a ruby

updated regarding to the comment:

Nuke one version and leave only one. I had same problem with two versions looking at different locations for gems. Had me going crazy for few weeks. Put up a bounty here at SO got me same answer I'm giving to you.

All I did was nuke one installation of ruby and left the one managable via ports. I'd suggest doing this:

  1. Remove ruby version installed via ports (yum or whatever package manager).
  2. Remove ruby version that came with OS (hardcore rm by hand).
  3. Install ruby version from ports with different prefix (/usr instead of /usr/local)
  4. Reinstall rubygems
Eimantas
**Thanks, your guess was right.** `[vineeth@localhost ~]$ which -a ruby /usr/local/bin/ruby /usr/local/bin/ruby /usr/bin/ruby` **What do I do now?**
Vineeth
A: 

Thanks a lot. Your suggestions worked. Saved some precious time!

Removed ruby using yum

Then, there was another ruby that wasn't removed by yum command. Had to "rm" it manually.

Then re-installed ruby, rails and gems. I used yum install ruby this time( earlier I'd downloaded the source code to install, that is available at www.rubyonrails.org). After installing ruby I followed the rest of the instructions given in the website. i.e download rubygems, "tar" it and "cd" to it. Then do "ruby setup.rb". And then "gem install rails". And one more important point is, there was no rdoc or ri or erb installed. So there was an error popping up again when I did "script/server" that was something to say about rdoc and ri. Then I'd to do "gem install rdoc ri". That's the last step. And voila, script/server worked!

Vineeth