Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"

I created a Ruby project, but when running bundle update and bundle install it returns an error:

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 

An image of it is: http://i.imgur.com/dZMhI11.png?1

My gemfile is:

ruby '2.0.0' #ruby-gemset=railstutorial_rails_4_0  gem 'rails', '4.0.0'  group :development do     gem 'sqlite3', '1.3.8' end  gem 'sass-rails', '4.0.0' gem 'uglifier', '2.1.1' gem 'coffee-rails', '4.0.0' gem 'jquery-rails', '3.0.4' gem 'turbolinks', '1.1.1' gem 'jbuilder', '1.0.2'  group :doc do     gem 'sdoc', '0.3.20', require: false end 
like image 769
theone1one Avatar asked Oct 13 '13 05:10

theone1one


People also ask

How do I change my Gemfile version?

Process: install the gem generically, looking up your target version on rubygems.org, then update and version your Gemfile. the install command is in the right-hand column. then you can: gem install gem_name -v 1.5.

How do I use Gemfile in Ruby?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.


2 Answers

I've noticed this happening when I've tried to bundle install with a fresh RVM gemset that didn't yet include bundler (as it fell back on the system bundler install which referenced the system ruby).

Running gem install bundler fixed for me.

like image 76
mistertim Avatar answered Sep 26 '22 02:09

mistertim


None of these worked for me, but I finally figured it out:

spring stop 

I had a Rails 4 project that uses something called Spring to keep a Rails environment running in the background, for speed.

I had started Spring with Ruby 2.1.1 but then I upgraded to 2.1.2 (in Gemfile and .ruby-version). My theory is that Spring kept on running on 2.1.1 and so caused this error.

like image 39
Henrik N Avatar answered Sep 26 '22 02:09

Henrik N