2

我在这里面临一个奇怪的问题。当我创建gemsetusingrvm时,更改的路径which rails。以下是我在终端上运行的命令。我在 SO 上提到了相关问题,但对我没有多大帮助。

someuser@ubuntu-laptop:~/sandbox/some_app$ rvm use 2.0.0
Using /home/someuser/.rvm/gems/ruby-2.0.0-p247

someuser@ubuntu-laptop:~/sandbox/some_app$ which ruby
/home/someuser/.rvm/rubies/ruby-2.0.0-p247/bin/ruby

someuser@ubuntu-laptop:~/sandbox/some_app$ which rails
/home/someuser/.rvm/gems/ruby-2.0.0-p247/bin/rails

someuser@ubuntu-laptop:~/sandbox/some_app$ rvm gemset use some_app (I also tried rvm gemset use 2.0.0@some_app --create)
Using ruby-2.0.0-p247 with gemset some_app

someuser@ubuntu-laptop:~/sandbox/some_app$ which ruby
/home/someuser/.rvm/rubies/ruby-2.0.0-p247/bin/ruby

someuser@ubuntu-laptop:~/sandbox/some_app$ which rails
/usr/local/bin/rails (<--- the path changed!)

rails sbundle命令给出错误:

someuser@ubuntu-laptop:~/sandbox/some_app$ rails s
-bash: /usr/local/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file or directory

我必须运行以下命令来修复路径:

someuser@ubuntu-laptop:~/sandbox/some_app$ rvm use 2.0.0
Using /home/someuser/.rvm/gems/ruby-2.0.0-p247

someuser@ubuntu-laptop:~/sandbox/some_app$ which rails
/home/someuser/.rvm/gems/ruby-2.0.0-p247/bin/rails

我有以下条目.bash_profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

为什么会这样?我该如何解决这个问题,所以路径不会随着 gemset 的更改/创建而改变?

4

1 回答 1

0

看来您以前会使用

sudo apt get install rails.

which rails返回rails路径中第一次出现的 。

试试这个 - 首先删除本机导轨sudo apt-get remove rails

于 2014-09-25T16:22:43.583 回答