Andrey M.
Andrey M.

Reputation: 3069

Ruby version incompatibility when installing via bundler

I want to install ruby on rails app via bundler with:

bundle install

It gets me following error:

Your Ruby version is 2.0.0, but your Gemfile specified 2.3.0

However if i run ruby -v i get following output:

ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

Upvotes: 1

Views: 148

Answers (4)

yeasayer
yeasayer

Reputation: 868

Your Ruby version is okay, I think the problem is with bundle command. You call bundle from your system preinstalled old Ruby. Run which bundle to locate it. I would recommend to switch to old Ruby, then uninstall gem bundler, then switch to new Ruby and reinstall gem bundler.

It's unclear which Ruby version manager you're using, so the basic command flow looks like this:

gem uninstall bundler # this command may require sudo
gem install bundler

Try switching Ruby versions inbetween commands, if this doesn't work.

Upvotes: 0

Khanh Pham
Khanh Pham

Reputation: 2973

I had some problems about version of ruby last time.

Case1, you should check your Gemfile, if your Gemfile have this line:

ruby '2.0.0', you should change to ruby '2.3.0', then it will work as well.

Case2, if you tried to do case1, and it doesn't work, you check file .ruby-version in your folder project. If it present, you only change:

2.0.0 to 2.3.0 and i think it will work as well.

Upvotes: 0

krazedkrish
krazedkrish

Reputation: 678

what ruby manger do you use ? rvm, rbenv, chruby ?

try adding the following file .ruby-version in your project folder in this file put the following line

ruby-2.3.1

then change to your home (or any other folder) and change to project folder back again

and also make sure which ever ruby manager it is, it is loaded replacing the system defaults.

i might be help you more after your response.

Upvotes: 1

David González
David González

Reputation: 455

Try a bundle update. You might have the incorrect version in your Gemfile.lock that bundle install is trying to follow.

Upvotes: 0

Related Questions