简体   繁体   English

Gemfile指定ruby-1.9.3,捆绑安装要求ruby-2.0.0

[英]Gemfile specify ruby-1.9.3, bundle install asks for ruby-2.0.0

I'm developing two different projects: one using ruby-1.9.3 and another using ruby-2.0.0 (the version of Rails changes too). 我正在开发两个不同的项目:一个使用ruby-1.9.3,另一个使用ruby-2.0.0(Rails的版本也会更改)。 I was developing the 2º project and now I'm coming back to the 1º (ruby 1.9.3), but I'm having some troubles. 我当时正在开发2º项目,现在又回到1º(红宝石1.9.3),但是遇到了一些麻烦。

Before start explain my problem, this is the result when I run rvm list : 在开始解释我的问题之前,这是我运行rvm list时的结果:

rvm rubies

=> ruby-1.9.3-p484 [ i686 ]
 * ruby-2.0.0-p353 [ i686 ]

# => - current
# =* - current && default
#  * - default

If I run ruby -v I got: 如果我运行ruby -v我得到:

ruby 1.9.3p484 (2013-11-22 revision 43786) [i686-linux]

And you can find in my gemfile of the first project: 您可以在我的第一个项目的gemfile中找到:

ruby '1.9.3'
gem 'rails', '3.2.3'

My problem is: I can't run the server and download/install the gems. 我的问题是:我无法运行服务器并下载/安装gem。 When I try to run rails s in my first project I get: 当我尝试在第一个项目中运行rails s ,我得到:

Could not find rake-10.1.0 in any of the sources
Run `bundle install` to install missing gems.

And when I try to run sudo bundle install I get: 当我尝试运行sudo bundle install我得到:

Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3

But you saw above that my gemfile specify 'ruby-1.9.3', not 'ruby-2.0.0'. 但是您在上面看到我的gemfile指定了“ ruby​​-1.9.3”,而不是“ ruby​​-2.0.0”。 What can I do to start work hard in my old project? 我该怎么做才能开始在旧项目中努力工作?

I'm guessing that there is some conflict between the native ruby installation and the RVM installation. 我猜测本机ruby安装和RVM安装之间存在一些冲突。

I recommend you try this: 我建议您尝试以下操作:

$ cd /path/to/ruby-1.9.3/project1
$ rvm use 1.9.3
$ rvm gemset create project1
$ rvm gemset use project1
$ bundle install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM