0

ruby 1.9.1 を削除して 1.8.7 をインストールしましたが、レールを探すときは bash がまだ 1.9.1 を指しています。

emai@vpc-db:~$ rails --version
bash: /usr/local/bin/rails: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory

emai@vpc-db:~$ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

誰でも助けることができますか?1.8.7 で bash を表示するにはどうすればよいですか?

4

1 に答える 1

2

あなたのルビーはかなり古いものです (そして今週の時点で公式に廃止されています)。あなたの宝石がにインストールされているのも本当に奇妙です/usr/local/bin

あなたはrbenvを調べたいかもしれません

これにより、おそらく問題がすぐに解決されます


rbenvのセットアップが完了したら、次のように ruby​​ をコンパイルします。

# start in your home directory
cd $HOME    

# make a src folder for compiling ruby
mkdir -p .src && cd .src    

# download ruby
curl -O ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz    

# extract compressed file
tar -xzf ruby-2.0.0-p247.tar.gz    

# cd to folder
cd ruby-2.0.0-p247    

# configure
./configure --prefix=$HOME/.rbenv/versions/2.0.0-p247 --with-opt-dir=/path/to/openssl --enable-shared    

# make and install
make && make install    

# cleanup
rm -rf ruby-2.0.0-p247

では使ってみましょう!

# make rbenv aware of our new rubies
rbenv rehash

# set our new version as the default
rbenv global 2.0.0-p247

# let's check it out!
ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]

それでは始めましょrails

# install rails
gem install rails

# check the version
rails --version
Rails 4.0.0
于 2013-07-12T21:10:46.907 に答える