2014-01-06 52 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]