Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rbenv Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2

I'm using rbenv and I have the follow error when I execute rails s

Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2

I was reading this thread: Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1

But the error persist.

rails -v
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2

and the commands

sudo gem install bundler 
rbenv rehash

$ which ruby /usr/bin/ruby

$ bundle exec which ruby Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2

doenst solve the problem. I'm doing something wrong?

like image 918
Benjamin RD Avatar asked Nov 23 '14 21:11

Benjamin RD


People also ask

What is Rbenv in Ruby?

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.


2 Answers

What version of ruby are you using?

ruby -v

It sounds like the Gemfile has a ruby requirement listed for 2.1.2. You may need to install that version:

rbenv install 2.1.2

Then you may need to tell rbenv to use that version for that project:

rbenv local 2.1.2

It looks like the rbenv team/community decided against adding support for ruby versions specified in the Gemfile. Reference: https://github.com/sstephenson/rbenv/issues/223

like image 88
Zach Dennis Avatar answered Nov 14 '22 23:11

Zach Dennis


If you get this in a Rails project, and you recently upgraded your ruby version you might have spring running with the old version of ruby. ./bin/spring stop will fix this.

like image 26
Myers Carpenter Avatar answered Nov 14 '22 21:11

Myers Carpenter