【问题标题】:RVM reports Gemfile ruby as not installedRVM 报告 Gemfile ruby​​ 未安装
【发布时间】:2014-01-06 05:59:19
【问题描述】:

在我的 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 选择它,并且rails 工作正常。

Gemfile 中的 ruby​​ 指令有问题吗?

我关注了official specification,有一个非常相似的例子。


编辑:在提示符下运行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'

【问题讨论】:

  • 如果你运行rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9会发生什么?它告诉你它已经安装了吗?
  • @AlexSiri 它开始下载ruby-1.9.3-p484(MRI 而不是 jruby)。我会让它完成下载,检查 rvm 的行为并报告。
  • 可能不会下载或使用jruby版本
  • @AlexSiri 是的,似乎没有。更新了我的帖子。
  • 我认为您最好创建一个.ruby-version 文件,rvm 在加载捆绑程序、Gemfile 和任何其他文件之前将使用该文件

标签: ruby rvm jruby


【解决方案1】:

根据this SO 回答:

RVM 对 ruby​​ 指令的支持有限,您可以使用注释覆盖 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]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 2013-12-27
    • 2014-06-13
    • 1970-01-01
    相关资源
    最近更新 更多