1

The problem I'm having is that after I clone the repo and try to test the app I get this error- "Your Ruby version is 2.2.3, but your Gemfile is specified 2.1.1."

Same error when I run bundle install or try to run the rails server. Do I need to install the older 2.1.1 version of ruby in order to test the app?

  • 3
    Use RVM or RBENV so you can have a different version of Ruby in different directories (repos) – Daiku Sep 14 '15 at 20:54
  • possible duplicate of [In Ruby: "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"](http://stackoverflow.com/questions/19342044/in-ruby-your-ruby-version-is-1-9-3-but-your-gemfile-specified-2-0-0) – Brad Werth Sep 14 '15 at 21:02
  • I found this guide extremely helpful when I started to work with rvm: http://code.tutsplus.com/articles/why-you-should-use-rvm--net-19529 – Mauddev Sep 14 '15 at 21:19

3 Answers3

3

You can install multiple ruby versions and switch between them using:

  1. rvm -- RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
  2. rbenv -- Use rbenv to pick a Ruby version for your application and guarantee that your development environment matches production.

With rbenv installed you can invoke:

rbenv install 2.1.1
ruby --version #=> 2.1.1
bundle install

Now you are ready to test your Rails app with the version intended by the author.

Workflow with rvm is very similar.

dimakura
  • 7,575
  • 17
  • 36
  • When I invoke rbenv install 2.1.1 it says it has installed 2.1.1, but when I check version it hasn't changed strange... – Danny Rosenfeld Sep 14 '15 at 22:31
  • Installing ruby-2.1.1... patching file ext/readline/readline.c patching file ext/readline/extconf.rb patching file ext/readline/extconf.rb Installed ruby-2.1.1 to /home/danny/.rbenv/versions/2.1.1 danny@danny-Dell-System-Inspiron-N7110:~$ ruby --version ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] – Danny Rosenfeld Sep 14 '15 at 22:32
2

I would recommend using a tool like RVM (Ruby Version Manager) and installing multiple rubies. You can see what rubies are installed with

 rvm list rubies
jjk
  • 536
  • 7
  • 15
0

Change the first line in your Gemfile to specify ruby 2.2.3.

soltex
  • 2,993
  • 1
  • 18
  • 29