2014-01-06 54 views
4

在我的Gemfile,我指定:RVM报告的Gemfile红宝石为未安装,

ruby '1.9.3', engine: 'jruby', engine_version: '1.7.9' 

但进入我的Rails项目目录,使rvm抛出了这个错误:

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
you can ignore these warnings with 'rvm rvmrc warning ignore /home/petey/rails/kotoba/Gemfile'. 
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 

ruby-1.9.3,engine:jruby,engine_version:1.7.9 is not installed. 
To install do: 'rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9' 

不过,我有jruby 1.7.9安装:

$ rvm list 

rvm rubies 

    jruby-1.7.9 [ x86_64 ] 
    ruby-1.9.3-p392 [ x86_64 ] 
=* ruby-2.0.0-p247 [ x86_64 ] 

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

$ rvm use jruby 
Using /home/petey/.rvm/gems/jruby-1.7.9 

$ ruby -v 
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64] 

其实我甚至可以用rvm use jruby和钢轨工作正常。

Gemfile中的ruby指令有问题吗?

我跟着official specification,它有一个非常相似的例子。


编辑:在在提示符下,RVM进行运行rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9安装ruby-1.9.3-p484。再一次,这说明在进入项目目录相同的错误消息:

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
you can ignore these warnings with 'rvm rvmrc warning ignore /home/petey/rails/kotoba/Gemfile'. 
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 

ruby-1.9.3,engine:jruby,engine_version:1.7.9 is not installed. 
To install do: 'rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9' 
+0

如果你运行'rvm install ruby​​-1.9.3,engine:jruby,engine_version:1.7.9',会发生什么?它是否告诉你它已经安装? –

+0

@AlexSiri它开始下载'ruby-1.9.3-p484'(MRI而不是jruby)。我会让它完成下载,检查rvm的行为并回报。 – peteykun

+0

这可能不会下载或使用jruby版本 –

回答

7

根据this SO回答:

RVM has limited support of the ruby directive, you can use comment to overwrite what will be used by RVM.


通过添加:

#ruby=jruby-1.7.9 

到刚刚在ruby指令下面的Gemfile,rvm似乎能够选择正确的ruby:

$ cd kotoba 
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
you can ignore these warnings with 'rvm rvmrc warning ignore /home/petey/rails/kotoba/Gemfile'. 
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 

$ ruby -v 
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64]