0
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 3 years have passed since last update.

heroku にデプロイできない

Last updated at Posted at 2021-11-03

かなり長いこと herokuにデプロイできなくて苦しんだ。

開発環境

ruby 2.6.5
Ruby on Rails 5.2.5
bundler 2.2.16

エラー内容 

heroku にデプロイする際に下記のエラーが発生

remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.6
remote: -----> Installing dependencies using bundler 2.2.16
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Your bundle only supports platforms ["x86_64-darwin-19"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock
remote:        --add-platform x86_64-linux` and try again.
remote:        Bundler Output: Your bundle only supports platforms ["x86_64-darwin-19"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock
remote:        --add-platform x86_64-linux` and try again.
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to infinite-bayou-54822.
remote: 
To https://git.heroku.com/infinite-bayou-54822.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/infinite-bayou-54822.git'

解決策

 push 前にターミナル上で以下のコマンドを入力

$ git add -A
$ git commit -m 'Add platform'
$ git push heroku master

これだけいけた

最初はいろいろと調査していくなかで

remote:  !     Failed to install gems via Bundler.

ここが悪いと思い bundler の様々なバージョンをためしたが、

どうやら僕の場合は

remote:        Your bundle only supports platforms ["x86_64-darwin-19"] but your local platform
remote:        is x86_64-linux. Add the current platform to the lockfile with `bundle lock

ここが悪かったよう。

ちなみに heroku-20 です。

参考にさせていただいた記事は以下

0
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
0
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?