12

I'm trying to bundle install a ruby project in Git Bash but I'm getting the above message.

ruby -v

ruby 2.2.4p230 (2015-12-16 revision 53155) [i836-mingw32]

gem -v

2.3.0

New to Ruby so its really frustrating. I'm trying to do the project below http://www.viralrails.com/?p=25

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
richie
  • 121
  • 1
  • 1
  • 3
  • Remove line `ruby '2.3.0'` from `Gemfile`, then rerun `bundle install`. – Aleksei Matiushkin Mar 08 '16 at 08:25
  • Don't do that. If your app depends on Ruby 2.3.0 this will be another problem. I posted an answer explaining step by step what must be done. – Ed de Almeida Mar 08 '16 at 08:45
  • 1
    How did you install Ruby? Do you use a Ruby version manager like RVM or rbenv? – spickermann Mar 08 '16 at 11:24
  • Possible duplicate of [Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0](https://stackoverflow.com/questions/23039528/your-ruby-version-is-2-0-0-but-your-gemfile-specified-2-1-0) – Bryan Ash Jun 24 '18 at 22:37

2 Answers2

20

This happens because you are specifying a Ruby version in your Gemfile (2.3.0) and this version is not installed or is not the current or default version.

Don't remove the line ruby '2.3.0' as someone said above. You app may have dependencies to this version. Do the following:

1) Check if you have Ruby 2.3.0 installed. If you are using rvm this may be done by

rvm list

and if you are using rbenv by

rbenv versions

2) If you don't have this Ruby version in your list of installed versions, then install it by issuing the following command

rvm install 2.3.0

and if you are using rbenv by

rbenv install 2.3.0

3) If you already had Ruby 2.3.0 installed or completed step 2 above, enter your app directory and issue the following command

rvm use 2.3.0

and if you are using rbenv by

rbenv local 2.3.0

Then run

bundle install

and I believe things will be ok.

Hope it helps!

Ed de Almeida
  • 3,675
  • 4
  • 25
  • 57
  • I don't think so. I just suggested things to correct his problem. But if it makes you feel great and smart downvoting a correct answer, feel free to do it. – Ed de Almeida Mar 08 '16 at 09:02
  • This can be a correct answer, __only__ if OP use the rvm ruby manager. – Roman Kiselenko Mar 08 '16 at 09:02
  • 5
    Then why don't you post a correct answer using other version manager? Or you prefer just criticizing, but not spending time answering? – Ed de Almeida Mar 08 '16 at 09:04
  • 1
    What a fantastic guy you are! You don't know the answer, then I post one that helps the OP and you downvote me. Thanks a lot for being a great human being! – Ed de Almeida Mar 08 '16 at 09:09
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/105652/discussion-between-ed-de-almeida-and-). – Ed de Almeida Mar 08 '16 at 09:12
  • @kfkhalili I edited the answer to show the correct command. Really sorry. I don't use rbenv, just rvm, and this caused the mistake. Hope it haven't caused any trouble. – Ed de Almeida May 08 '16 at 15:30
  • 1
    @EddeAlmeida I guess you meant `rbenv local 2.3.0` instead of `rbenv local 2.3.9` in your 3rs step? – Shyam Bhimani Jun 06 '16 at 23:49
1

Install bundler after installing ruby 2.4.0.

gem install bundler

If you installed bundler before installing ruby 2.4.0 then you should reinstall bundler or update it.

Also if the above command didn't work.

gem update bundler
Ahmad
  • 1,497
  • 2
  • 9
  • 16