Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0

萝らか妹 提交于 2019-11-26 12:26:40
Зелёный

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.

Myers Carpenter

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.

Darme

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]

user5315333

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:

  1. open Gemfile which located at your directory.
  2. change ruby '2.3.0' to ruby '2.5.1' and save the Gemfile
  3. go back to items and run bundle update.

the issue is perfectly solved.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!