[RUBY] À propos de Gem :: ConflictError (activesupport)

Cette fois, lorsque j'ai essayé d'exécuter minitest, une erreur a soudainement commencé à apparaître, je vais donc décrire l'arrière-plan et la solution.

L'environnement était le suivant.

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

Cet article concerne une erreur survenue lors de la progression du texte ci-dessous.

En ce qui concerne la moindre erreur, l'auteur a également affiché diverses solutions, mais la situation ne s'appliquait à aucune d'entre elles. J'ai soudainement eu une erreur dans le test pendant que le livre était en cours, donc j'ai pensé que c'était probablement dû à un autre travail que j'ai fait entre les deux, donc veuillez vous référer uniquement à ceux qui ont une telle expérience.

Voici les détails de l'erreur.

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)

Il y a un conflit entre 6.0.3.1 et 5.1.7 de support actif.

L'un des facteurs qui me vient à l'esprit est que j'ai travaillé sur diverses choses lors de la création de l'application avec sinatra la veille.

En conséquence, il a été résolu en désinstallant le 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

J'ai désinstallé la version 6.0.3.1 ci-dessus.

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

En conséquence, nous avons pu le tester et le vérifier.

Pour référence, la version après la désinstallation sera publiée à nouveau.

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

J'espère que cela sera utile pour ceux qui sont également bloqués.

Recommended Posts

À propos de Gem :: ConflictError (activesupport)
gem active_hash À propos du hachage actif
À propos =
[Version japonaise Faker] À propos du joyau "gimei"