Why are my Ruby versions conflicting?

南笙酒味 提交于 2019-12-12 01:15:47

问题


When I run ruby -v in my ~home folder, I get:

ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]

But now I am trying to run an app, and there are some missing gems. Searching for them, I am told to run this app using Ruby 1.9, but in the /app folder, when I run ruby -v, I get:

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Why is it so and how can I recover my 2.0. current version of Ruby?


回答1:


Usually you would use some kind of Ruby version management tool like rvm or rbenv.
These make it possible to have a unique Ruby version for every project (AKA directory), as well as separate gem sets.

Using rvm you can switch your current Ruby by running rvm use ruby-1.8.7.

Check your project directory using ls -a for files like:

  • .rvmrc
  • .ruby-version

Normally the required Ruby version is selected here and used as soon as you cd into the project directory.



来源:https://stackoverflow.com/questions/17436452/why-are-my-ruby-versions-conflicting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!