The package uses the wrong version of ruby

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 use rbenv if that matters. rbenv versionsgives the following: system * 2.2.3 (set by /Users/thatsme/Projects/demoproject/.ruby-version) therefore I did not install ruby 2.1.7. Spring is not working and I started rbenv rehash. Then installed bundler gem. I'm going crazy. Can someone please tell me why the wrong ruby ​​version is used? Thanks!

+4
source share
2 answers

Assumption: you are using RVM. This means that the ruby ​​version is installed outside the RVM. Clear rubies rvm by running

rvm uninstall <ruby version>

rvm rubies do ruby -v, , , .

sudo apt-get remove ruby

rvm rubies rvm install <ruby version> rvm use <ruby version>

bundler

gem install bundler

bundle install

+2

.

bundle exec rails c

0

Source: https://habr.com/ru/post/1613858/


All Articles