エラーを読んでみると `bundle lock--add-platform x86_64-linux`
と書いてあったのでターミナルで入力して、コミットしてpushして見たところ同じエラーが出ました。

下記のサイトを参考に、Gemfile.lockを再度生成してみましたが変わりませんでした。

[HerokuへPushする際に「Failed to install gems via
Bundler.」が出た時の対処法](https://yumishin.com/heroku-push-error/)

こちらのサイトで似たような記事があったので、試してみましたが、変わらず同じエラーが出ています。

分からないまま時間だけが過ぎていく状態です。どうかご教授お願いします。

**実行環境:**

  * Ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
  * Bundler version 2.2.21

* * *

`heroku logs --tail` の実行結果

```

    2021-08-30T12:24:49.448523+00:00 app[api]: Release v1 created by user メールアドレス
    2021-08-30T12:24:49.448523+00:00 app[api]: Initial release by user メールアドレス
    2021-08-30T12:24:49.717428+00:00 app[api]: Release v2 created by user メールアドレス
    2021-08-30T12:24:49.717428+00:00 app[api]: Enable Logplex by user メールアドレス
    2021-08-30T12:24:58.000000+00:00 app[api]: Build started by user メールアドレス
    2021-08-30T12:25:02.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/9f407441-7fa5-4b6f-8325-806781542c5f/activity/builds/4365eca8-9fc6-4c89-ae4e-c8fa29e4442d
    2021-08-30T12:26:43.000000+00:00 app[api]: Build started by user メールアドレス
    2021-08-30T12:26:46.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/9f407441-7fa5-4b6f-8325-806781542c5f/activity/builds/b09ba2f0-6fdc-4050-a741-f9096d8ccd11
    2021-08-30T12:27:30.000000+00:00 app[api]: Build started by user メールアドレス
    2021-08-30T12:27:33.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/9f407441-7fa5-4b6f-8325-806781542c5f/activity/builds/2a7cc295-e1fb-400e-8125-7b6976ebe39e
    2021-08-30T12:34:06.000000+00:00 app[api]: Build started by user メールアドレス
    2021-08-30T12:34:10.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/9f407441-7fa5-4b6f-8325-806781542c5f/activity/builds/a2afee68-5c3f-43f0-b3f0-a05cd981c331
    2021-08-30T12:43:55.000000+00:00 app[api]: Build started by user メールアドレス
    2021-08-30T12:43:59.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/9f407441-7fa5-4b6f-8325-806781542c5f/activity/builds/9e1e58ea-4eca-4ec5-bdfa-7406e802bbf8
    
```

`git push heroku master` の実行結果

```

    Enumerating objects: 125, done.
    Counting objects: 100% (125/125), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (105/105), done.
    Writing objects: 100% (125/125), 146.54 KiB | 6.37 MiB/s, done.
    Total 125 (delta 11), reused 0 (delta 0), pack-reused 0
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Building on the Heroku-20 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.21
    remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
    remote: -----> Compiling Ruby/Rails
    remote: -----> Using Ruby version: ruby-3.0.2
    remote: -----> Installing dependencies using bundler 2.2.21
    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-20"] 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-20"] 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:  !
    remote:  ! ## Warning - The same version of this code has already been built: 9dfb754c4483d008134222a2332ba8ccf1ffb43c
    remote:  !
    remote:  ! We have detected that you have triggered a build from source code with version 9dfb754c4483d008134222a2332ba8ccf1ffb43c
    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 アプリ名
    remote: 
    To https://git.heroku.com/アプリ名.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to アプリ名.git
    
```

Gemfile

```

    source 'https://rubygems.org'
    git_source(:github) { |repo| "https://github.com/#{repo}.git" }
    
    ruby '3.0.2'
    
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
    gem 'rails', '~> 6.1.4', '>= 6.1.4.1'
    # Use postgresql as the database for Active Record
    gem 'pg', '~> 1.1'
    # Use Puma as the app server
    gem 'puma', '~> 5.0'
    # Use SCSS for stylesheets
    gem 'sass-rails', '>= 6'
    # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
    gem 'webpacker', '~> 5.0'
    # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
    gem 'turbolinks', '~> 5'
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 2.7'
    # Use Redis adapter to run Action Cable in production
    # gem 'redis', '~> 4.0'
    # Use Active Model has_secure_password
    # gem 'bcrypt', '~> 3.1.7'
    
    # Use Active Storage variant
    # gem 'image_processing', '~> 1.2'
    
    # Reduces boot times through caching; required in config/boot.rb
    gem 'bootsnap', '>= 1.4.4', require: false
    
    group :development, :test do
      # Call 'byebug' anywhere in the code to stop execution and get a debugger console
      gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
    end
    
    group :development do
      # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
      gem 'web-console', '>= 4.1.0'
      # Display performance information such as SQL time and flame graphs for each request in your browser.
      # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
      gem 'rack-mini-profiler', '~> 2.0'
      gem 'listen', '~> 3.3'
      # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
      gem 'spring'
      gem 'sqlite3'
    end
    
    group :test do
      # Adds support for Capybara system testing and selenium driver
      gem 'capybara', '>= 3.26'
      gem 'selenium-webdriver'
      # Easy installation and use of web drivers to run system tests with browsers
      gem 'webdrivers'
    end
    
    # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
    gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
    
    
```

Gemfile.lock

```

    GEM
      remote: https://rubygems.org/
      specs:
        actioncable (6.1.4.1)
          actionpack (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          nio4r (~> 2.0)
          websocket-driver (>= 0.6.1)
        actionmailbox (6.1.4.1)
          actionpack (= 6.1.4.1)
          activejob (= 6.1.4.1)
          activerecord (= 6.1.4.1)
          activestorage (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          mail (>= 2.7.1)
        actionmailer (6.1.4.1)
          actionpack (= 6.1.4.1)
          actionview (= 6.1.4.1)
          activejob (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          mail (~> 2.5, >= 2.5.4)
          rails-dom-testing (~> 2.0)
        actionpack (6.1.4.1)
          actionview (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          rack (~> 2.0, >= 2.0.9)
          rack-test (>= 0.6.3)
          rails-dom-testing (~> 2.0)
          rails-html-sanitizer (~> 1.0, >= 1.2.0)
        actiontext (6.1.4.1)
          actionpack (= 6.1.4.1)
          activerecord (= 6.1.4.1)
          activestorage (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          nokogiri (>= 1.8.5)
        actionview (6.1.4.1)
          activesupport (= 6.1.4.1)
          builder (~> 3.1)
          erubi (~> 1.4)
          rails-dom-testing (~> 2.0)
          rails-html-sanitizer (~> 1.1, >= 1.2.0)
        activejob (6.1.4.1)
          activesupport (= 6.1.4.1)
          globalid (>= 0.3.6)
        activemodel (6.1.4.1)
          activesupport (= 6.1.4.1)
        activerecord (6.1.4.1)
          activemodel (= 6.1.4.1)
          activesupport (= 6.1.4.1)
        activestorage (6.1.4.1)
          actionpack (= 6.1.4.1)
          activejob (= 6.1.4.1)
          activerecord (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          marcel (~> 1.0.0)
          mini_mime (>= 1.1.0)
        activesupport (6.1.4.1)
          concurrent-ruby (~> 1.0, >= 1.0.2)
          i18n (>= 1.6, < 2)
          minitest (>= 5.1)
          tzinfo (~> 2.0)
          zeitwerk (~> 2.3)
        addressable (2.8.0)
          public_suffix (>= 2.0.2, < 5.0)
        bindex (0.8.1)
        bootsnap (1.8.1)
          msgpack (~> 1.0)
        builder (3.2.4)
        byebug (11.1.3)
        capybara (3.35.3)
          addressable
          mini_mime (>= 0.1.3)
          nokogiri (~> 1.8)
          rack (>= 1.6.0)
          rack-test (>= 0.6.3)
          regexp_parser (>= 1.5, < 3.0)
          xpath (~> 3.2)
        childprocess (3.0.0)
        concurrent-ruby (1.1.9)
        crass (1.0.6)
        erubi (1.10.0)
        ffi (1.15.3)
        globalid (0.5.2)
          activesupport (>= 5.0)
        i18n (1.8.10)
          concurrent-ruby (~> 1.0)
        jbuilder (2.11.2)
          activesupport (>= 5.0.0)
        listen (3.7.0)
          rb-fsevent (~> 0.10, >= 0.10.3)
          rb-inotify (~> 0.9, >= 0.9.10)
        loofah (2.12.0)
          crass (~> 1.0.2)
          nokogiri (>= 1.5.9)
        mail (2.7.1)
          mini_mime (>= 0.1.1)
        marcel (1.0.1)
        method_source (1.0.0)
        mini_mime (1.1.1)
        minitest (5.14.4)
        msgpack (1.4.2)
        nio4r (2.5.8)
        nokogiri (1.12.3-x86_64-darwin)
          racc (~> 1.4)
        pg (1.2.3)
        public_suffix (4.0.6)
        puma (5.4.0)
          nio4r (~> 2.0)
        racc (1.5.2)
        rack (2.2.3)
        rack-mini-profiler (2.3.2)
          rack (>= 1.2.0)
        rack-proxy (0.7.0)
          rack
        rack-test (1.1.0)
          rack (>= 1.0, < 3)
        rails (6.1.4.1)
          actioncable (= 6.1.4.1)
          actionmailbox (= 6.1.4.1)
          actionmailer (= 6.1.4.1)
          actionpack (= 6.1.4.1)
          actiontext (= 6.1.4.1)
          actionview (= 6.1.4.1)
          activejob (= 6.1.4.1)
          activemodel (= 6.1.4.1)
          activerecord (= 6.1.4.1)
          activestorage (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          bundler (>= 1.15.0)
          railties (= 6.1.4.1)
          sprockets-rails (>= 2.0.0)
        rails-dom-testing (2.0.3)
          activesupport (>= 4.2.0)
          nokogiri (>= 1.6)
        rails-html-sanitizer (1.4.2)
          loofah (~> 2.3)
        railties (6.1.4.1)
          actionpack (= 6.1.4.1)
          activesupport (= 6.1.4.1)
          method_source
          rake (>= 0.13)
          thor (~> 1.0)
        rake (13.0.6)
        rb-fsevent (0.11.0)
        rb-inotify (0.10.1)
          ffi (~> 1.0)
        regexp_parser (2.1.1)
        rubyzip (2.3.2)
        sass-rails (6.0.0)
          sassc-rails (~> 2.1, >= 2.1.1)
        sassc (2.4.0)
          ffi (~> 1.9)
        sassc-rails (2.1.2)
          railties (>= 4.0.0)
          sassc (>= 2.0)
          sprockets (> 3.0)
          sprockets-rails
          tilt
        selenium-webdriver (3.142.7)
          childprocess (>= 0.5, < 4.0)
          rubyzip (>= 1.2.2)
        semantic_range (3.0.0)
        spring (2.1.1)
        sprockets (4.0.2)
          concurrent-ruby (~> 1.0)
          rack (> 1, < 3)
        sprockets-rails (3.2.2)
          actionpack (>= 4.0)
          activesupport (>= 4.0)
          sprockets (>= 3.0.0)
        sqlite3 (1.4.2)
        thor (1.1.0)
        tilt (2.0.10)
        turbolinks (5.2.1)
          turbolinks-source (~> 5.2)
        turbolinks-source (5.2.0)
        tzinfo (2.0.4)
          concurrent-ruby (~> 1.0)
        web-console (4.1.0)
          actionview (>= 6.0.0)
          activemodel (>= 6.0.0)
          bindex (>= 0.4.0)
          railties (>= 6.0.0)
        webdrivers (4.6.1)
          nokogiri (~> 1.6)
          rubyzip (>= 1.3.0)
          selenium-webdriver (>= 3.0, < 4.0)
        webpacker (5.4.2)
          activesupport (>= 5.2)
          rack-proxy (>= 0.6.1)
          railties (>= 5.2)
          semantic_range (>= 2.3.0)
        websocket-driver (0.7.5)
          websocket-extensions (>= 0.1.0)
        websocket-extensions (0.1.5)
        xpath (3.2.0)
          nokogiri (~> 1.8)
        zeitwerk (2.4.2)
    
    PLATFORMS
      x86_64-darwin-20
    
    DEPENDENCIES
      bootsnap (>= 1.4.4)
      byebug
      capybara (>= 3.26)
      jbuilder (~> 2.7)
      listen (~> 3.3)
      pg (~> 1.1)
      puma (~> 5.0)
      rack-mini-profiler (~> 2.0)
      rails (~> 6.1.4, >= 6.1.4.1)
      sass-rails (>= 6)
      selenium-webdriver
      spring
      sqlite3
      turbolinks (~> 5)
      tzinfo-data
      web-console (>= 4.1.0)
      webdrivers
      webpacker (~> 5.0)
    
    RUBY VERSION
       ruby 3.0.2p107
    
    BUNDLED WITH
       2.2.21
    
```
CC BY-SA 4.0
2021-08-30T13:45:18.517
81120
2021-08-30T16:19:37.293
2021-08-30T16:19:37.293
3060
47983
question
ruby-on-rails ruby git heroku
rails6版でgit push heroku masterでデプロイできない