Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundle uses wrong ruby version

Tags:

I'm trying to run

env RAILS_ENV=test bundle exec rake db:migrate

and get the following error

Your Ruby version is 2.1.7, but your Gemfile specified 2.2.3

ruby -v

gives me

ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]

I'm using rbenv, if that matters. rbenv versions gives the following: system * 2.2.3 (set by /Users/thatsme/Projects/demoproject/.ruby-version) So I have no ruby 2.1.7 installed. Spring is not running and I've run rbenv rehash. Then bundler gem is installed. I'm going nuts on this. Can somebody please tell me why the wrong ruby version is being used? Thanks!

like image 767
Linus Avatar asked Oct 30 '15 15:10

Linus


People also ask

How do you change bundles in Ruby?

You can update the ruby version by running `bundle update --ruby`, and that will update the lock to match your current version of Ruby the same way Bundler currently updates gem versions.

How do I choose a Ruby version?

Set Ruby version with rvm on Mac 0 on the command line. To switch to the system ruby, enter rvm use system . To switch back to the default, rvm default . The command rvm list will show all installed Rubies, including the current and default versions.

How does bundle work Ruby?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as bundle install .


Video Answer


1 Answers

Running the command below helped me somehow: rbenv exec gem install bundler

like image 141
Ricardo Green Avatar answered Sep 17 '22 17:09

Ricardo Green