Your Ruby version is 2.2.4, but your Gemfile speci

2019-02-17 00:37发布

问题:

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

回答1:

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!