1
votes

I have installed ruby 1.9.3 and now when I want to start "rails server" on a project I get this error: /usr/bin/env: ruby1.8: No such file or directory

I saw in some posts that I have to change PATH of something but I don't know how to do that. I am new in linux.

echo $PATH:
~/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binβ€Œβ€‹:/sbin:/bin:/usr/games:/home/mordehai/.rvm/bin:/home/mordehai/.rvm/bin 

I installed few times with "sudo apt-get install ruby1.9.3, and with rvm

3
can you copy-paste your echo $PATH output + how do you install ruby, source code/synaptic/rvm? – ekremkaraca
~/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/mordehai/.rvm/bin:/home/mordehai/.rvm/bin this is the output, and I installed few times with "sudo apt-get install ruby1.9.3, and with rvm – Mor Haham

3 Answers

2
votes

you are missing basics of RVM:

rvm install 2.0.0
rvm use 2.0.0 --default # The default arg is needed only first time
gem install rails
# rails new myapp && cd myapp
rails server
2
votes

I had this issue on an older Debian install that's gone through at least one apt-get dist-upgrade.

Looking around for the culprit it quickly became apparent that there was a bunch of cruft left over after an upgrade of the system ruby.

grep -r "ruby1.8" /usr/bin/*
/usr/bin/erubis:#!/usr/bin/ruby1.8
/usr/bin/rackup:#!/usr/bin/ruby1.8
/usr/bin/rails:#!/usr/bin/ruby1.8
...
/usr/bin/X11/redcloth:#!/usr/bin/ruby1.8

Too many references to fix & I don't want to maintain all these files, so It seemed easier to make ruby1.8 available to any scripts that were expecting it.

Fixing was as easy as running

ln -s /usr/bin/ruby /usr/bin/ruby1.8
0
votes

I have been facing this kind of problem too, so this is how i fixed it. It might not be permanent solution but here it is: every time before you start your server change the path to the following being in your project directory:

$ source ~/.rvm/scripts/rvm

then you can run your server

$ rails s

i am sure you are good to go