Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile [duplicate]

Today I tried to build a docker for my rails 6.1.0 with active storage, I got the following error:

Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.5) has removed it. You'll need to update your
bundle to a version other than mimemagic (0.3.5) that hasn't been removed in order to install.

And now I try to install the mimemagic

 gem install mimemagic -v 0.3.5

I've got the following error:

ERROR:  Could not find a valid gem 'mimemagic' (= 0.3.5) in any repository
ERROR:  Possible alternatives: mimemagic

It seems like the gem is gone. Can someone explain this?

what can be the solution to this issue?


Solution 1:

Few days ago, the mimemagic versions were yanked. More info can be found at:

  • https://github.com/rails/rails/issues/41750
  • https://rubygems.org/gems/mimemagic/versions

You can modify your Gemfile as below:

gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'

Solution 2:

Try to remove the Gemfile.lock and bundle again. Make sure you can actually do that because all your gems will be updated. In my Rails 6.1 instances, mimemagic is no longer used. Done.

If that is not possible, you need to update mimemagic as it seems they removed all versions below 0.3.7: bundle update mimemagic

Update: I'm not sure if it's clear, but rails no longer use mimemagic.