I have multiple verstions of rails and ruby gems on my machine and I ran into the error below when I tried to run any rails command such as rails -v, rails new new_app, etc.
.../ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate activesupport-5.1.0, already activated activesupport-5.0.1 (Gem::LoadError)
Here's how I fixed it.
The version conflict points to ActiveSupport so I ran the command below to check the different versions of activesupport on my machine:
gem list | grep activesupport
The result of the command was:
activesupport (5.1.0, 5.0.1, 5.0.0, 4.2.8, 4.2.6, 4.2.5.1, 4.2.5)
Then, I attempted to uninstall both version 5.1.0 and 5.0.1 to see which has the least dependent gems and then chose to uninstall 5.1.0 and it's dependent gems which were only activemodel and activerecord of the same version. Version 5.0.1 had a lot more dependent gems.
The unistall command:
gem uninstall activesupport -v 5.1.0