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!
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.
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.
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 .
Running the command below helped me somehow:
rbenv exec gem install bundler
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With