Ruby on Rails - 糟糕的翻译

时间:2014-09-25 15:51:25

标签: ruby-on-rails rvm bundle gemset

我在这里遇到一个奇怪的问题。当我使用gemset创建rvm时,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时不会发生变化?

1 个答案:

答案 0 :(得分:0)

您以前似乎已经使用

安装了rails

sudo apt get install rails

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

尝试此操作 - 首先执行sudo apt-get remove rails

删除原生导轨