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

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

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

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

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Q&A

解決済

2回答

1129閲覧

Herokuにrailsアプリをデプロイしたいがmimemagicに関連したエラーが出て失敗する

aizack

総合スコア22

Ruby on Rails 6

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

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

1グッド

2クリップ

投稿2022/02/25 01:46

編集2022/02/26 08:15

現在Rails Tutorialを進めているのですが、そのアプリをHerokuにデプロイする際に以下のようなエラーメッセージがHerokuで出ており、失敗します。
※追記依頼としてGemfileとGemfile.lockの内容を質問文に記載するように言われたものの、文字数制限に引っかかるため、依頼者様へのツリーへ記載しております。

以下に私の前提理解とHerokuでビルドエラーメッセージの関連ありそうな部分を抜粋しておきますので、ご確認の上、アドバイスいただけると助かります。

前提理解

こちらで認識していること

  • herokuのメッセージから読み取るに、mimemagic(0.3.10)がないことが問題になっている可能性
  • デプロイ元コード側のmimemagicのバージョンは 0.3.2 となっていること

上記に対して試したこと

  • OSにshared-mime-infoをinstallする
  • Gemfile.lockのmimemagicバージョンをあげようと試みるが失敗(0.3.2に固定されてしまう)

Herokuで出たビルドエラーメッセージ(以下のURLに全文が表示されています)

https://pastebin.com/UJc9Pk1R

Gemfile(以下のURLに全文が表示されています)

https://pastebin.com/tPpwJHxL

Gemfile.lock(以下のURLに全文が表示されています)

https://pastebin.com/PakGG7NR

どうぞよろしくおねがいします。

shinoharat👍を押しています

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

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

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

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

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

shinoharat

2022/02/25 07:14

Gemfile および Gemfile.lock の中身を質問文に追加してください。
aizack

2022/02/25 07:49

質問の文字数制限に引っかかるため、こちらにGemfileとGemfile.lockの内容を記述させていただきます。 ご迷惑おかけします。 ### Gemfile ```source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'rails','6.0.3' gem 'puma', '4.3.6' gem 'sass-rails', '5.1.0' gem 'webpacker','4.0.7' gem 'turbolinks', '5.2.0' gem 'jbuilder', '2.9.1' gem 'bootsnap', '1.4.5', require: false group :development, :test do gem 'sqlite3', '1.4.1' gem 'byebug','11.0.1', platforms: [:mri, :mingw, :x64_mingw] end group :development do gem 'web-console', '4.0.1' gem 'listen','3.1.5' gem 'spring','2.1.0' gem 'spring-watcher-listen', '2.0.1' end group :test do gem 'capybara', '3.28.0' gem 'selenium-webdriver', '3.142.4' gem 'webdrivers', '4.1.2' gem 'rails-controller-testing', '1.0.4' gem 'minitest', '5.11.3' gem 'minitest-reporters', '1.3.8' gem 'guard','2.16.2' gem 'guard-minitest', '2.4.6' end group :production do gem 'pg', '1.1.4' end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] ``` ### Gemfile.lock ```GEM remote: https://rubygems.org/ specs: actioncable (6.0.3) actionpack (= 6.0.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.0.3) actionpack (= 6.0.3) activejob (= 6.0.3) activerecord (= 6.0.3) activestorage (= 6.0.3) activesupport (= 6.0.3) mail (>= 2.7.1) actionmailer (6.0.3) actionpack (= 6.0.3) actionview (= 6.0.3) activejob (= 6.0.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.0.3) actionview (= 6.0.3) activesupport (= 6.0.3) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (6.0.3) actionpack (= 6.0.3) activerecord (= 6.0.3) activestorage (= 6.0.3) activesupport (= 6.0.3) nokogiri (>= 1.8.5) actionview (6.0.3) activesupport (= 6.0.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (6.0.3) activesupport (= 6.0.3) globalid (>= 0.3.6) activemodel (6.0.3) activesupport (= 6.0.3) activerecord (6.0.3) activemodel (= 6.0.3) activesupport (= 6.0.3) activestorage (6.0.3) actionpack (= 6.0.3) activejob (= 6.0.3) activerecord (= 6.0.3) marcel (~> 0.3.1) activesupport (6.0.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) bindex (0.8.1) bootsnap (1.4.5) msgpack (~> 1.0) builder (3.2.4) byebug (11.0.1) capybara (3.28.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) childprocess (2.0.0) rake (< 13.0) coderay (1.1.3) concurrent-ruby (1.1.9) crass (1.0.6) erubi (1.10.0) ffi (1.15.5) formatador (1.1.0) globalid (1.0.0) activesupport (>= 5.0) guard (2.16.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) pry (>= 0.9.12) shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) guard-minitest (2.4.6) guard-compat (~> 1.2) minitest (>= 3.0) i18n (1.10.0) concurrent-ruby (~> 1.0) jbuilder (2.9.1) activesupport (>= 4.2.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loofah (2.14.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) mimemagic (0.3.10) nokogiri (~> 1) rake mini_mime (1.1.2) minitest (5.11.3) minitest-reporters (1.3.8) ansi builder minitest (>= 5.0) ruby-progressbar msgpack (1.4.5) nenv (0.3.0) nio4r (2.5.8) nokogiri (1.13.3-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) pg (1.1.4) pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) puma (4.3.6) nio4r (~> 2.0) racc (1.6.0) rack (2.2.3) rack-proxy (0.7.2) rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.3) actioncable (= 6.0.3) actionmailbox (= 6.0.3) actionmailer (= 6.0.3) actionpack (= 6.0.3) actiontext (= 6.0.3) actionview (= 6.0.3) activejob (= 6.0.3) activemodel (= 6.0.3) activerecord (= 6.0.3) activestorage (= 6.0.3) activesupport (= 6.0.3) bundler (>= 1.3.0) railties (= 6.0.3) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) railties (6.0.3) actionpack (= 6.0.3) activesupport (= 6.0.3) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (12.3.3) rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.8.2) ruby-progressbar (1.11.0) ruby_dep (1.5.0) rubyzip (1.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.1.0) railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) selenium-webdriver (3.142.4) childprocess (>= 0.5, < 3.0) rubyzip (~> 1.2, >= 1.2.2) shellany (0.0.1) spring (2.1.0) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.1) thor (1.2.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.0) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.9) thread_safe (~> 0.1) web-console (4.0.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) webdrivers (4.1.2) nokogiri (~> 1.6) rubyzip (~> 1.0) selenium-webdriver (>= 3.0, < 4.0) webpacker (4.0.7) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.5.4) PLATFORMS x86_64-linux DEPENDENCIES bootsnap (= 1.4.5) byebug (= 11.0.1) capybara (= 3.28.0) guard (= 2.16.2) guard-minitest (= 2.4.6) jbuilder (= 2.9.1) listen (= 3.1.5) minitest (= 5.11.3) minitest-reporters (= 1.3.8) pg (= 1.1.4) puma (= 4.3.6) rails (= 6.0.3) rails-controller-testing (= 1.0.4) sass-rails (= 5.1.0) selenium-webdriver (= 3.142.4) spring (= 2.1.0) spring-watcher-listen (= 2.0.1) sqlite3 (= 1.4.1) turbolinks (= 5.2.0) tzinfo-data web-console (= 4.0.1) webdrivers (= 4.1.2) webpacker (= 4.0.7) BUNDLED WITH 2.2.17 ```
guest

回答2

0

自己解決

Rails Tutorialの運営元の方にこの問題が伝わり調べていただいた所、以下の解決策を得たので方法を載せておきます。
端的に言うとGemfileのrailsとbootsnapのバージョンを修正前から修正後のようにアップデートする必要があるそうです。

Gemfile(修正前)

1gem 'rails', '6.0.3' 2gem 'bootsnap', '1.4.5', require: false

Gemfile(修正後)

1gem 'rails', '6.0.4.6' 2gem 'bootsnap', '1.10.3', require: false

原因は不明ですが、テキストで過去にできていたことができなくなっていたようです。

投稿2022/02/26 15:06

編集2022/03/01 01:58
aizack

総合スコア22

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

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

0

古い mimemagic がライセンスの関係で rubygems.org から削除されたのが原因ではないかと思います。

【1】Gemfile 側でバージョンを明示的に指定し、

Gemfile

1gem "mimemagic", "~> 0.3.10"

【2】以下のコマンドで Gemfile.lock をアップデートしてください。

bundle update mimemagic

(参考URL: https://hackmd.io/@mametter/mimemagic-info-ja)

--

ただ、エラーメッセージだと

An error occurred while installing mimemagic (0.3.10)

になっていて、バージョン 0.3.10 なら問題はないはずなので、もしかしたら別の原因かもしれないです。
また結果を教えていただけると嬉しいです🙏

投稿2022/02/25 08:01

shinoharat

総合スコア1676

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

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

aizack

2022/02/25 08:38 編集

解答ありがとうございます。 以下を実行しましたが、同様のエラーメッセージで失敗しました… ・mimemagicを明示的に0.3.10にupdate後herokuへデプロイ 以下がその際に表示されたものです。 ### Herokuのエラーメッセージ ``` An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue. In Gemfile: 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 ! ! Failed to install gems via Bundler. ! ! Push rejected, failed to compile Ruby app. ! Push failed ```
shinoharat

2022/02/25 11:25

情報ありがとうございます。 エラー変わってないっぽいですね。 もう少し調べてみます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問