Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM reports Gemfile ruby as not installed

Tags:

ruby

rvm

jruby

In my Gemfile, I have specified:

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

But entering my Rails project directory makes rvm throw up this error:

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'

However, I do have jruby 1.7.9 installed:

$ 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]

In fact, I can even select it with rvm use jruby and rails works fine.

Is there a problem with the ruby directive in the Gemfile?

I followed the official specification, which has a very similar example.


Edit: On running rvm install ruby-1.9.3,engine:jruby,engine_version:1.7.9 at the prompt, rvm proceeds to install ruby-1.9.3-p484. And once again, it shows the same error message on entering the project directory:

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'
like image 662
peteykun Avatar asked Mar 22 '23 02:03

peteykun


1 Answers

According to this SO answer:

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


By adding:

#ruby=jruby-1.7.9

to the Gemfile just below the ruby directive, rvm seems to be able to pick the right 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]
like image 70
peteykun Avatar answered Mar 31 '23 13:03

peteykun