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

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

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

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Ruby on Rails

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

Q&A

解決済

1回答

1576閲覧

git push heroku でエラー Failed to install gems via Bundler.がでます

monnmomo

総合スコア3

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2021/03/29 05:39

編集2021/03/29 07:31

前提・実現したいこと

railsアプリをherokuでデプロイするところで詰まってします。

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

git push heroku master

を行うと以下のものがでます。多分失敗してますよね。

Counting objects: 7691, done. Delta compression using up to 4 threads. Compressing objects: 100% (6245/6245), done. Writing objects: 100% (7691/7691), 34.01 MiB | 3.66 MiB/s, done. Total 7691 (delta 1009), reused 7564 (delta 985) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-18 stack remote: -----> Determining which buildpack to use for this app remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> Ruby app detected remote: -----> Installing bundler 2.2.11 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.5.5 remote: -----> Installing dependencies using bundler 2.2.11 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 remote: Fetching gem metadata from https://rubygems.org/............ remote: Your bundle is locked to mimemagic (0.3.5), but that version could not be found remote: in any of the sources listed in your Gemfile. If you haven't changed sources, remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed remote: in order to install. remote: Bundler Output: Fetching gem metadata from https://rubygems.org/............ remote: Your bundle is locked to mimemagic (0.3.5), but that version could not be found remote: in any of the sources listed in your Gemfile. If you haven't changed sources, remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed remote: in order to install. remote: remote: ! remote: ! Failed to install gems via Bundler. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: 462b7af89e288e242ac9f14de6*********** remote: ! remote: ! We have detected that you have triggered a build from source code with version 462b7af89e288e242ac9f14de6260********** remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to appname remote: To https://git.heroku.com/appname.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/appname.git'

この上で、

heroku open

を行うと以下のエラーがでます。

▸ Error opening web browser. ▸ Error: Exited with code 3 ▸ ▸ Manually visit https://circlethree.herokuapp.com/ in your ▸ browser.

試したこと

sudo heroku buildpacks

でbuildpaksを確認したところ、no Buildpack URL set.と返されたので、

sudo heroku buildpacks:set heroku/ruby

でbuildpacksをいれました(?)これでsudo heroku buildpacksをしたら、

=== appname Buildpack URL heroku/ruby

と表示されるようになりました。でも、
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
が消えただけで、あいかわらずgit pushしてもエラーがでます。

また、ローカルとherokuのbundlerのバージョンを合わせれば治るという記事をみて確認したけれど、どちらもversion 2.2.11でした。まだ治りません。
https://yumishin.com/heroku-push-error/

補足情報(FW/ツールのバージョンなど)

mysqlを使いたいので、

heroku addons:add cleardb

というコマンドを打ち、結果は

Created cleardb-reticulated-***** as CLEARDB_SILVER_URL Use heroku addons:docs cleardb to view documentation

と出ているので、データベースはちゃんと作れているのだと思います。

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

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

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

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

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

guest

回答1

0

ベストアンサー

mimemagic 問題ですね。Rails を最新マイナーバージョン (5.2.5 / 6.0.3.6 / 6.1.3.1) にすると良いでしょう。

(Rails のバージョンをそのままにしたい場合は、bundle update mimemagic する方法もあります。この際、ローカル環境でエラーが出たら、Ubuntu なら apt-get install shared-mime-info でしょうか。)

参考: mimemagicの最新動向 - HackMD
参考: Heroku - bundle installの結果、mimemagic (0.3.9)がインストールされていないとエラーが返ってくる|teratail

投稿2021/03/29 06:02

編集2021/03/29 07:02
hoshi-takanori

総合スコア7895

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

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

monnmomo

2021/03/29 06:48

ご回答ありがとうございます。 railsを5.2.5にし、apt-get install shared-mime-info を行いました。 bundle update mimemagic もやってみたのですが、Could not find gem 'mimemagic'.と返されました。なので、gemfileにgem 'mimemagic'を記入したうえでもう一度やったら、Using mimemagic 0.4.3となりました。 しかしこれでも、push herokuで同じエラーが出てしまいます・・・。
hoshi-takanori

2021/03/29 07:00

ごめんなさい、rails を 5.2.5 にした場合は、mimemagic も shared-mime-info も不要になります。
monnmomo

2021/03/29 07:21

ありがとうございます。元のrails5.2.4.5でmimemagic とshared-mime-info入れてもやってみたのですが、やっぱりダメみたいです・・・。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問