When I try to bundle install I get the following message:
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0
In my Gemfile I have the following:
ruby '2.1.0'
And when I run ruby -v
in the console I get:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
What does Ruby 2.1.0p0 mean? What version should I have in my Gemfile and why does the error tell me I have Ruby version 2.0.0?
Run
gem install bundler
or
gem update bundler
which may fix your problem.
For all new installed versions of Ruby you should update or install a new bundler.
In the top-level directory of your project, create a file named .ruby-version
containing (wait for it...)
2.1.0
That apparently is the cross-{rbenv,rvm}
way of spec'ing the version now.
If you get this in a Rails project, and you recently upgraded your Ruby version you might have spring still running with the old version of Ruby.
./bin/spring stop
will fix this.
For me, none of the answers helped. I fixed it closing and opening again the terminal.
If you are using Capistrano you should also check your deploy.rb
file for the set :rbenv_ruby
configuration.
I got this after upgrading with ruby-install. Fixed this with:
gem install bundler
followed by:
$HOME/.rubies/ruby-2.4.1/bin/bundle
It shouldn't be necessary to specify the path as which bundle
indicates it's already using this path. But it gives the version error if running bundle
without the path. I don't know why?
NONE of the above answers worked for me, but
$ gem pristine --all
did the trick for me
buona fortuna
If you are using rbenv to manage your ruby environments you can run rbenv local 2.1.0
within your project directory to set the version of ruby your gemfile asks for.
None of the other suggestions was working for me. On the server, I had to do:
rvm --default use [correct version number]
For more advanced projects .versions.conf is supported, where more than the Ruby version can be specified.
Generating .versions.conf:
rvm --create --versions-conf use 1.9.3@my_app
Example .versions.conf:
ruby=jruby-1.6.8
ruby-gemset=my_app
env-JRUBY_OPTS=--1.9
Make sure your server configuration points to the correct ruby installation.
I had already updated my Ruby version in the .ruby-version
file and that didn't fix it. ruby -v
also showed the correct version, but I had forgotten to update my server config.
For example, with rbenv, NGINX, and Pushion Passenger I had in my NGINX server block:passenger_ruby /Users/myusername/.rbenv/versions/2.3.1/bin/ruby;
And I needed to change to...passenger_ruby /Users/myusername/.rbenv/versions/2.3.3/bin/ruby;
Then restarted NGINX and it worked.
brew cleanup ruby
worked for me as I use HomeBrew to install Ruby.
I recently updated Ruby through HomeBrew but HomeBrew did not remove the older version. brew cleanup ruby
will delete the older version of Ruby.
This could happen when you install new version of ruby and update .ruby-version and Gemfile to the new version without doing install all the gems for new version of ruby first. So do the
$ bundle install
and you might as well need to source .profile or restart your shell.
Thanks for the info about installing / updating bundler but it didn't work for me.
I had to do rbenv rehash
Had the same error. Doing the following fixed it. I was using ruby 2.5.5 and rbenv. Upgraded from 2.5.1.
- rbenv rehash
- gem uninstall bundler
- gem install bundler
- gem install bundler:1.17.3 (my app needed specific bundler -v 1.17.3)
- gem install rails
I face the error msg
Your Ruby version is 2.5.1, but your Gemfile specified 2.3.0
and solved by the following steps:
- open Gemfile which located at your directory.
- change
ruby '2.3.0'
toruby '2.5.1'
and save the Gemfile - go back to items and run bundle update.
the issue is perfectly solved.
来源:https://stackoverflow.com/questions/23039528/your-ruby-version-is-2-0-0-but-your-gemfile-specified-2-1-0