我在这里面临一个奇怪的问题。当我创建gemset
usingrvm
时,更改的路径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 s
或bundle
命令给出错误:
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 的更改/创建而改变?