/usr/bin/env: ruby1.8: No such file or directory

2019-08-10 22:37发布

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条回答
Rolldiameter
2楼-- · 2019-08-10 23:20

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

查看更多
乱世女痞
3楼-- · 2019-08-10 23:37

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
查看更多
成全新的幸福
4楼-- · 2019-08-10 23:37

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
查看更多
登录 后发表回答