rikuto_hr
@rikuto_hr (yama rikuto)

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

rails 環境構築

解決したいこと

rails -v 5.2.4.4入れたいです。

発生している問題・エラー

ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    current directory: /Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10/ext/mimemagic
/Users/yama/.rbenv/versions/2.6.6/bin/ruby -rrubygems /Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake RUBYARCHDIR\=/Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/mimemagic-0.3.10 RUBYLIBDIR\=/Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/mimemagic-0.3.10
rake aborted!
Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]

Ensure you have either installed the shared-mime-info package for your distribution, or
obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
of that file.

This gem might be installed as a dependency of some bigger package, such as rails, activestorage,
axlsx or cucumber. While most of these packages use the functionality of this gem, some gems have
included this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are certain that you
do not need this gem, and wish to skip the inclusion of freedesktop.org.xml.

The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature, and will be deprecated in
the next release.

Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10 for inspection.
Results logged to /Users/yama/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/mimemagic-0.3.10/gem_make.out

または、問題・エラーが起きている画像をここにドラッグアンドドロップ

該当するソースコード

gem install rails -v 5.2.4.4

自分で試したこと

拡張機能?が失敗したと書いてあり、gemに問題があるのかなと思いbundleしたりしました。
https://b1nary.hatenablog.com/entry/2017/10/06/175642
あとこちらも参考にしましたがよく見るエラーの内容が全く違くよくわかりませんですた。
個人的には
Tasks: TOP => default
(See full trace by running task with --trace)
ここの部分が鍵なのかなと思いましたが、全くわかりませんでした。

0

1Answer

rails 5.2.4.4はGPLの問題が解決していないのではないでしょうか?
shared-mime-infoをインストールしてPATHを環境変数にセットする必要があると思います。
もしこだわりが無ければRails 5.2.5をお勧めします。

0Like

Comments

  1. @rikuto_hr

    Questioner

    ありがとうございます、rails5,2,5にしました。

Your answer might help someone💌