質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

2810閲覧

環境構築でbundleインストールのエラーの件

higmonta

総合スコア29

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/04/13 06:55

下記内容で環境構築を試みています。
$ git checkout -b fix_[自分のアカウント名]
$ rbenv local 2.6.6
$ nodenv local 12.14.0
$ bundle install --without production
$ yarn install
$ rails db:migrate
$ rails server

現状発生している問題・エラーメッセージ

higmonta@higuchiyuunoMBP Exam_RailsBasic_01 % rails db:migrate
Could not find mimemagic-0.3.10 in any of the sources
Run bundle install to install missing gems.
どの処理までうまく動いているのか

最初に掲げた環境構築の条件のうち以下は、うまくいっています。
$ git checkout -b fix_[自分のアカウント名]
$ rbenv local 2.6.6
$ nodenv local 12.14.0
$ yarn install

エラーから考えられる原因

rails db:migrateのエラー内容からもmimemagicのmimemagic-0.3.10のインストールができていないのかと考えました。
最初に掲げた環境構築の条件にある以下コマンドを実行した結果が以下になっています。

higmonta@higuchiyuunoMBP Exam_RailsBasic_01 % bundle install --without production
[DEPRECATED] The --without flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use bundle config set --local without 'production', and stop using this flag
Fetching source index from https://rubygems.org/

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>
Using rake 13.0.3
Using concurrent-ruby 1.1.7
Using minitest 5.14.3
Using thread_safe 0.3.6
Using zeitwerk 2.4.2
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.5.0
Using racc 1.5.2
Using crass 1.0.6
Using rack 2.2.3
Using nio4r 2.5.4
Using ffi 1.14.2
Using mini_mime 1.0.2
Using byebug 11.1.3
Using public_suffix 4.0.6
Using regexp_parser 1.8.2
Using childprocess 3.0.0
Using rb-fsevent 0.10.4
Using method_source 1.0.0
Using thor 1.0.1
Using rubyzip 2.3.0
Using tilt 2.0.10
Using spring 2.1.1
Using sqlite3 1.4.2
Using turbolinks-source 5.2.0
Using i18n 1.8.7
Using tzinfo 1.2.9
Using nokogiri 1.11.1 (x86_64-darwin)
Using rack-test 1.1.0
Using sassc 2.4.0
Using rb-inotify 0.10.1
Using puma 4.3.7
Using rack-proxy 0.6.5
Using sprockets 4.0.2
Using activesupport 6.0.3.4
Using loofah 2.8.0
Using execjs 2.7.0
Using addressable 2.7.0
Using bcrypt 3.1.16
Using listen 3.4.0
Using bindex 0.8.1
Using turbolinks 5.2.1
Using rails-dom-testing 2.0.3
Using bundler 2.2.16
Using globalid 0.4.2
Using selenium-webdriver 3.142.7
Using jbuilder 2.10.1
Using autoprefixer-rails 10.2.0.0
Using spring-watcher-listen 2.0.1
Using activejob 6.0.3.4
Using webdrivers 4.4.2
Using bootstrap-sass 3.4.1
Using activemodel 6.0.3.4
Fetching mimemagic 0.3.10
Using activerecord 6.0.3.4
Using websocket-extensions 0.1.5
Using mail 2.7.1
Using websocket-driver 0.7.3
Using xpath 3.2.0
Using msgpack 1.3.3
Using capybara 3.34.0
Using bootsnap 1.5.1
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.3.4
Using actionpack 6.0.3.4
Using actioncable 6.0.3.4
Using actionmailer 6.0.3.4
Using railties 6.0.3.4
Using sprockets-rails 3.2.2
Using web-console 4.1.0
Using sassc-rails 2.1.2
Using webpacker 4.3.0
Using sass-rails 6.0.0
Installing mimemagic 0.3.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/higmonta/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10/ext/mimemagic
/Users/higmonta/.rbenv/versions/2.6.6/bin/ruby -rrubygems
/Users/higmonta/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/exe/rake
RUBYARCHDIR=/Users/higmonta/.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/higmonta/.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/higmonta/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10
for inspection.
Results logged to
/Users/higmonta/.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

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

In Gemfile:
rails was resolved to 6.0.3.4, which depends on
actionmailbox was resolved to 6.0.3.4, which depends on
activestorage was resolved to 6.0.3.4, which depends on
marcel was resolved to 0.3.3, which depends on
mimemagic
試したこと

試したこと1
上記の内容にwithoutフラグは、非推奨になったとあるので、記載通りの下記コマンドを実行しました。

higmonta@higuchiyuunoMBP Exam_RailsBasic_01 % bundle config set --local without 'production'
higmonta@higuchiyuunoMBP Exam_RailsBasic_01 %
上記のように何も返ってきませんでした。

試したこと2

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>
上記内容より下記のAのサイトを参考に再起動しました。
上記のような内容が出たのは、試したこと1が実際はうまくいっていないからなのでは無いかと考えました。

試したこと3
mimemagicにエラーが関係していると考え、ターミナルにてgem listで確認したところ、mimemagicの記載がありませんでした。
補講課題(バグ修正)のgemlockファイルには、mimemagicが記載されているため、それが原因かとも思いました。
一旦mimemagicのみインストールして試してみようと試みたところ以下のようになってしまいました。

higmonta@higuchiyuunoMBP Exam_RailsBasic_01 % gem install mimemagic -v '0.3.10' --source
ERROR: While executing gem ... (OptionParser::MissingArgument)
missing argument: --source
今度は引数がおかしいと上記のようなエラーが出てしまいました。

下記のエラーよりmimemagicにエラーがあると自分で考察して試行錯誤している状況です。

higmonta@higuchiyuunoMBP Exam_RailsBasic_01 % rails db:migrate
Could not find mimemagic-0.3.10 in any of the sources
Run bundle install to install missing gems.
bundle installで実行してもダメでした。

参考にしたURL

(A)https://julie-dayo.net/it/bundle_install/

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

mimemagic で検索すると以下の記事が出ます。Railsのバージョンを更新するなりして対処しましょう。
https://hackmd.io/@mametter/mimemagic-info-ja

投稿2021/04/13 07:21

mather

総合スコア6753

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問