close

[Solved] Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker

Hello Guys, How are you all? Hope You all Are Fine. I am facing an error Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker. So Here I am Explain to you all the possible solutions Here.

Without Wasting your time, Lets start This Article to Solve This Error.

How Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker This Error Occurs ?

I’m aware of the recent mimemagic issues, which I managed to resolve on one of my Rails projects by bundle updating to 0.3.7 – but for some reason, I can’t resolve it on the project below.

I have a Rails 6 project which I’m setting up for the first time on a new laptop. My laptop doesn’t have the correct Ruby setup, so I’ve added a Dockerfile to my project like so:-

I then try:-

docker-compose build
docker-compose up

Along with every combination of the following:-

  • Using bundle update mimemagic in my dockerfile
  • Adding the gem specifically to my Gemfile with gem 'mimemagic', '~> 0.3.7'
  • Manually changing my Gemfile.lock mimemagic version from 0.3.5 to 0.3.7
  • Adding RUN apt-get install shared-mime-info to my Dockefile

and I simply get one of the below:-

Could not find mimemagic-0.3.x in any of the sources

How to Solve Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker ?

Question: How to Solve Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker ?
Answer:
bundle update –conservative mimemagic also try with newer version rather than locking it. it worked for us with 0.3.9, but now there is 0.3.10(have not tried it).

Solution 1

bundle update --conservative mimemagic 

you can also try with a newer version rather than locking it. it worked for us with 0.3.9, but now there is 0.3.10(have not tried it).

Solution 2

You can modify your Gemfile as below:

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

Solution 3

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

You can modify your Gemfile as below:

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

Solution 4

If you are using macOS

brew install shared-mime-info
bundle update mimemagic

Solution 5

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

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment