What happened to mimemagic? @rails activerecord depends on @basecamp marcel which depends on mimemagic 0.3.2. Now that mimemagic 0.3.2 has been yanked, what is the way forward?
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.
The mimemagic software library provided a component of Rails called Active Storage with mime type data β used to identify file formats β and was initially distributed under an MIT license. But mimemagic has a dependency of its own called shared-mime-info that is distributed under the GPLv2 license.
Note: upgrading to Mimemagic 0.3.8 is still under GPL-2.0 license which may not be desirable under all circumstances.
I ran into this today and here's what I ended up doing to fix the issue
(I'm on a MBP Catalina 10.15.7)
Step 1: update Gemfile.lock to mimemagic 0.3.8 by running
$ brew install shared-mime-info
$ bundle update mimemagic
(Be sure the system you're deploying to has the proper libraries installed).
β Mimemagic issue solved thanks to this comment
Step 2: Upgrade yarn packages
when I did this, it updated everything in homebrew so when I went to restart my server, I received the
Your Yarn packages are out of date!
Please run `yarn install` to update.
but, running $yarn install
gave me the error:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.67.dylib
Referenced from: /usr/local/bin/node
and
yarn check v1.22.10
warning Integrity check: System parameters don't match
error Integrity check failed
error Found 1 errors.
Finally fixed yarn issues by running
$ yarn --update-checksums
π Yarn Issue solved (thanks to this blog post )
Step 3 Last, brew also updated my Postgresql from 12 to 13.2 so I received the
PG::ConnectionBad - could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
No PID to remove, stopping and restarting, unloading and reloading, launch ctl didn't work... finally, this worked check postgres.log by running
$ tail -n 10 /usr/local/var/log/postgres.log
last line shows:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.2.
ππ» Fixed with:
$ brew postgresql-upgrade-database
Last, postgres db upgrade fixed thanks to this post
You can get the gem back. The gem binary built might have been removed but the commit ref of each release still there. You can ref to the gem with the github commit ref like this:
# 0.3.2
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '3543363026121ee28d98dfce4cb6366980c055ee'
for other commit ref you can see this link:
https://github.com/mimemagicrb/mimemagic/commits/0.3?after=22c06826417ed67c02b94ebc9998c24da5a03c56+69&branch=0.3
Rails team has posted a patch update that remove the mimemagic dependency. The Marcel library now uses Apache Tika, released under the permissive and compatible Apache License 2.0
Read more at: https://weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases/
The gem author has pulled all versions due the gem itself violating the GPL license requirements. Currently there's people working solutions to make a MIT compatible solution or to work around the dependencies.
Discussion: https://github.com/rails/rails/issues/41750
hard coded gem reference for a workaround here
Please install shared-mime-info and add FREEDESKTOP_MIME_TYPES_PATH in your environment. if you use windows or linux, please download from https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0440063a2e6823a4b1a6fb2f2af8350f/shared-mime-info-2.0.tar.xz and extract it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With