. Advertisement .
..3..
. Advertisement .
..4..
If you are running Docker on CircleCI, you may encounter the error “Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker” when installing gems to your app. This happens when you try to run bundle install or rails g within the docker container. Continue reading to fix it.
How To Fix The Error “Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker”?
I’m aware of the current mimemagic problems, which I was capable of resolving on one of my Rails projects by upgrading to 0.3.7, but I’m unable to do so on the following project for some reasons.
I’m starting a new laptop with a Rails 6 project. Because my laptop lacks the proper Ruby setup, I’ve included a Dockerfile to the project as follows:
Then, I try:
docker-compose build
docker-compose up
In addition to any combination of the following:
- In my dockerfile, I utilize bundle update mimemagic
- With gem’mimemagic’, ‘> 0.3.7’, I’ve added the gem to my Gemfile.
- Modifying my Gemfile by hand.
- Upgrade mimemagic from 0.3.5 to 0.3.7.
- Including RUN apt-get install shared-mime-info to the Dockefile.
I only have one of the following after
Could not find mimemagic-0.3.x in any of the sources
Instead of locking it, you can use bundle update –conservative mimemagic with a newer version. We were able to get it to work with 0.3.9, yet there is now 0.3.10. (have not used it yet).
Option 1
bundle update –conservative mimemagic
Instead of locking it, you can use bundle update –conservative mimemagic with a newer version. We were able to get it to work with 0.3.9, yet there is now 0.3.10. (have not used it yet).
Option 2
You can make the following changes to your Gemfile:
gem ‘mimemagic’, github: ‘mimemagicrb/mimemagic’, ref: ’01f92d86d15d85cfd0f20dabd025dcbd36a8a60f’
Option 3
The mimemagic versions were removed a few days ago. More information is available at:
https://rubygems.org/gems/mimemagic/versions
https://github.com/rails/rails/issues/41750
You can make the following changes to your Gemfile:
gem ‘mimemagic’, github: ‘mimemagicrb/mimemagic’, ref: ’01f92d86d15d85cfd0f20dabd025dcbd36a8a60f’
Option 4
If you are a macOS user
brew install shared-mime-info
bundle update mimemagic
Option 5
Delete the Gemfile.lock file and re-bundle. Ensure you’re capable of doing so, as all of your gems will be upgraded. Mimemagic is no longer used in my Rails 6.1 instances.
If that isn’t an option, you’ll need to upgrade mimemagic, as it appears that all versions prior to 0.3.7 have been deleted: bundle update mimemagic
Conclusion
We hope you found our blog post on solving the error “Bundler::GemNotFound: Could not find mimemagic-0.3.5 in any of the sources on Rails project with Docker”. If you have any further queries or concerns about this topic, please leave a comment. Thank you for reading; we are always glad when one of our articles provides useful knowledge on this subject!
Leave a comment