RVM报告未安装Gemfile ruby

pet*_*kun 4 ruby jruby rvm

在我的Gemfile中,我指定了:

ruby '1.9.3', engine: 'jruby', engine_version: '1.7.9'
Run Code Online (Sandbox Code Playgroud)

但进入我的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'
Run Code Online (Sandbox Code Playgroud)

但是,我确实安装了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]
Run Code Online (Sandbox Code Playgroud)

事实上,我甚至可以选择它rvm use jruby并且rails工作正常.

Gemfile中的ruby指令有问题吗?

我遵循官方规范,其中有一个非常相似的例子.


编辑:rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9提示符下运行时,rvm继续安装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'
Run Code Online (Sandbox Code Playgroud)

pet*_*kun 7

根据这个 SO回答:

RVM对ruby指令的支持有限,您可以使用注释来覆盖RVM将使用的内容.


通过增加:

#ruby=jruby-1.7.9
Run Code Online (Sandbox Code Playgroud)

对于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]
Run Code Online (Sandbox Code Playgroud)