1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

mimemagicのbundle installに手間取った件

Posted at

起きたこと

しばらく昔に触っていたローカルでそのまま動かしていたRuby on Railsプロジェクトを久々に動かそうとbundle installしたら、以下のエラーが。

Gem files will remain installed in /Users/hoge/projects/hogehoge/vendor/bundle/ruby/2.7.0/gems/mimemagic-0.3.9 for inspection.
Results logged to /Users/hoge/projects/GitHub/hogehoge/vendor/bundle/ruby/2.7.0/extensions/x86_64-darwin-21/2.7.0/mimemagic-0.3.9/gem_make.out

An error occurred while installing mimemagic (0.3.9), and Bundler cannot continue.
Make sure that `gem install mimemagic -v '0.3.9' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  breadcrumbs_on_rails was resolved to 4.0.0, which depends on
    rails was resolved to 6.0.3, which depends on
      actionmailbox was resolved to 6.0.3, which depends on
        activestorage was resolved to 6.0.3, which depends on
          marcel was resolved to 0.3.3, which depends on
            mimemagic

やったこと

その1 gem install

なんか昔も同じことで引っかかったなぁと思いつつ、言われた通りに個別にgem install

$ gem install mimemagic -v '0.3.9' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed mimemagic-0.3.9
Parsing documentation for mimemagic-0.3.9
Done installing

成功するやん、と思ってもう一回bundle install
→おなじエラーで失敗
ワンアウト!

その2 shared-mime-infoの再インストール

ググってみると以下のような記事が
https://techblg.app/articles/handle-error-occurred-while-installing-mimemagic/

ググった感じ、同じエラーに遭遇したほとんどの先人たちが下記コマンドでshared-mime-infoを入れ直してbundle installしなおせば解消するって言ってる

$ brew install shared-mime-info
Warning: shared-mime-info 2.2 is already installed and up-to-date.
To reinstall 2.2, run:
  brew reinstall shared-mime-info

もう入ってるよーとのこと。
念の為resintallしてbundle install

$ brew reinstall shared-mime-info
$ bundle install

→おなじエラーで失敗
ツーアウト!

その3 一度bundle installしたGemを全て削除して再インストール

エラー文をもう一度読み直すと以下の記載が

Gem files will remain installed in /Users/hoge/projects/hogehoge/vendor/bundle/ruby/2.7.0/gems/mimemagic-0.3.9 for inspection.
Results logged to /Users/hoge/projects/GitHub/hogehoge/vendor/bundle/ruby/2.7.0/extensions/x86_64-darwin-21/2.7.0/mimemagic-0.3.9/gem_make.out

エラー文的に、残ってる(remain)gemがイケてなさそうだなぁと思って一度vendor/bundleを吹っ飛ばして、再度bundle install

$ rm -rf vendor/bundle
$ bundle install

成功して、再びプロジェクト動くようになりました。Happy Smileツーベースヒット!🤗

。。。
時間ある時Dockerで動かせるようにしようと思いました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?