[RUBY] About Gem :: ConflictError (activesupport)

This time, when I tried to run minitest, an error suddenly started to appear, so I will describe the background and solution.

The environment was as follows.

ruby 2.6.3
Rails 5.1.7
minitest (5.14.1, 5.14.0, 5.11.3, 5.10.3, 5.10.1)

This article is about an error that occurred while advancing the text below.

-Introduction to Ruby for those who aim to become professionals

Regarding the minitest error, the author also posted various solutions, but the situation did not apply to any of them. I suddenly got an error in the test while the book was in progress, so I thought it was probably due to another work I did in between, so please refer only to those who have such experience.

Below are the details of the error.

ec2-user:~/environment/ruby-book $ ruby lib/sample_test.rb
Traceback (most recent call last):
        9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:68:in `block in autorun'
        8: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:126:in `run'
        7: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `load_plugins'
        6: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `each'
        5: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:103:in `block in load_plugins'
        4: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `                   require'
        3: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        2: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.1.7/lib/minitest/rails_plugin.rb:2:in `<top (required)>'
        1: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
/home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require': cannot load such file -- rails/test_unit/reporter (LoadError)
        12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:68:in `block in autorun'
        11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:126:in `run'
        10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `load_plugins'
         9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `each'
         8: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:103:in `block in load_plugins'
         7: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         6: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         5: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.1.7/lib/minitest/rails_plugin.rb:2:in `<top (required)>'
         4: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
         3: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
         2: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:218:in `try_activate'
         1: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:1415:in `activate'
/home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:2298:in `raise_if_conflicts': Unable to activate railties-5.1.7, because activesupport-6.0.3.1 conflicts with activesupport (= 5.1.7) (Gem::ConflictError)
        13: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:68:in `block in autorun'
        12: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:126:in `run'
        11: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `load_plugins'
        10: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:97:in `each'
         9: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/minitest-5.14.1/lib/minitest.rb:103:in `block in load_plugins'
         8: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         7: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         6: from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.1.7/lib/minitest/rails_plugin.rb:2:in `<top (required)>'
         5: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
         4: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
         3: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:217:in `try_activate'
         2: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:224:in `rescue in try_activate'
         1: from /home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:1415:in `activate'
/home/ec2-user/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:2298:in `raise_if_conflicts': Unable to activate railties-5.1.7, because activesupport-6.0.3.1 conflicts with activesupport (= 5.1.7) (Gem::ConflictError)

There is a conflict between 6.0.3.1 and 5.1.7 of active support.

One of the factors that comes to mind is that I worked on various things when creating the app on sinatra the day before.

As a result, it was solved by uninstalling the gem.

ec2-user:~/environment/ruby-book $ gem uninstall activesupport -v 6.0.3.1

You have requested to uninstall the gem:
        activesupport-6.0.3.1

activemodel-6.0.3.1 depends on activesupport (= 6.0.3.1)
activerecord-6.0.3.1 depends on activesupport (= 6.0.3.1)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled activesupport-6.0.3.1

I have uninstalled 6.0.3.1 above.

ec2-user:~/environment/ruby-book $ ruby lib/sample_test.rb
Run options: --seed 27045

# Running:

E

Finished in 0.002129s, 469.6838 runs/s, 0.0000 assertions/s.

  1) Error:
SampleTest#test_sample:
NoMethodError: undefined method `upcase' for nil:NilClass
Did you mean?  case
    lib/sample_test.rb:5:in `test_sample'

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips

ec2-user:~/environment/ruby-book $ ruby test/deep_freezable_test.rb
Run options: --seed 56480

# Running:

.

Finished in 0.002055s, 486.6611 runs/s, 486.6611 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

As a result, we were able to test and verify it.

For reference, the version after uninstallation will be posted again.

ec2-user:~/environment/ruby-book $ gem list | grep activesupport
activesupport (5.1.7, 5.1.6, 5.0.0)

I hope it will be helpful for those who are similarly clogged.

Recommended Posts

About Gem :: ConflictError (activesupport)
gem active_hash About active hash
About =
[Japanese version Faker] About the gem "gimei"