

### 前提・実現したいこと

Ruby on
Railsを使ってアプリを開発していた際にgithubを通してHerokuにデプロイしていたのですが，ある時誤まってherokuのappを消してしまいました．  
そこで新しくappを作り直し，git remote set-url heroku URL を打ち込んでpush先を変えてgit push heroku
master を打ち込んだら以下のようなエラーメッセージが出ました．

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

[code]

    (base) mbp:hello hoge$ git push heroku master
    Enumerating objects: 87, done.
    Counting objects: 100% (87/87), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (72/72), done.
    Writing objects: 100% (87/87), 22.64 KiB | 2.26 MiB/s, done.
    Total 87 (delta 2), reused 0 (delta 0)
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    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: -----> Compiling Ruby/Rails
    remote: -----> Using Ruby version: ruby-2.5.5
    remote: -----> Installing dependencies using bundler 2.0.2
    省略
    remote:        * For more details, please refer to the Sass blog:
    remote:          https://sass-lang.com/blog/posts/7828841
    remote:        
    remote:        Bundle completed (51.26s)
    remote:        Cleaning up the bundler cache.
    remote: -----> Installing node-v10.15.3-linux-x64
    remote: -----> Detecting rake tasks
    remote: 
    remote:  !
    remote:  !     Could not detect rake tasks
    remote:  !     ensure you can run `$ bundle exec rake -P` against your app
    remote:  !     and using the production group of your Gemfile.
    remote:  !     Activating bundler (2.0.1) failed:
    remote:  !     Could not find 'bundler' (2.0.1) required by your /tmp/build_cf0cee9dff2cef20e79c0cb16f784873/Gemfile.lock.
    remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
    remote:  !     To install the missing version, run `gem install bundler:2.0.1`
    remote:  !     Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
    remote:  !     
    remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
    remote:  !
    remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
    remote: ensure you can run `$ bundle exec rake -P` against your app
    remote: and using the production group of your Gemfile.
    remote: Activating bundler (2.0.1) failed:
    remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_cf0cee9dff2cef20e79c0cb16f784873/Gemfile.lock.
    remote: To update to the latest version installed on your system, run `bundle update --bundler`.
    remote: To install the missing version, run `gem install bundler:2.0.1`
    remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
    remote: 
    remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:866:in `rake'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:84:in `block (2 levels) in run_assets_precompile_rake_task'
    省略
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:40:in `compile'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:20:in `block (2 levels) in <main>'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:134:in `log'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:19:in `block in <main>'
    省略
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:35:in `trace'
    remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:15:in `<main>'
    remote:  !     Push rejected, failed to compile Ruby app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy...
    remote: 
    remote: !    Push rejected to shrouded-ocean-42963.
    remote: 
    To https://git.heroku.com/shrouded-ocean-42963.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/shrouded-ocean-42963.git'
    
[/code]

### 試したこと

仕方ないので，新しくプロジェクトを書き直して新しいgitのリポジトリからherokuにデプロイしようとしても再び **同じようなエラー** が出ました．  
さらに，herokuのアカウントも作り直して，rails newしたばかりのプロジェクトをherokuにあげるという誰がやってもデプロイできるという状況でも
**同じエラー** が出ます


CC BY-SA 4.0
2019-07-01T12:27:02.160
56293
2019-07-04T02:07:51.813
34935
question
ruby-on-rails git heroku github
Herokuにデプロイできなくなりました

[code]

    remote: -----> Installing dependencies using bundler 2.0.2
    
[/code]

となっているので、heroku上ではbundler 2.0.2がインストールされているようです。そのあとのログで

[code]

    remote:  !     Could not detect rake tasks
    remote:  !     ensure you can run `$ bundle exec rake -P` against your app
    remote:  !     and using the production group of your Gemfile.
    remote:  !     Activating bundler (2.0.1) failed:
    remote:  !     Could not find 'bundler' (2.0.1) required by your /tmp/build_cf0cee9dff2cef20e79c0cb16f784873/Gemfile.lock.
    remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
    remote:  !     To install the missing version, run `gem install bundler:2.0.1`
    remote:  !     Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
    remote:  !     
    remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
    
[/code]

となっているので、ローカルではbundler 2.0.1を利用しているようですね。なので

  * ローカルでbundler 2.0.2をインストール
  * bundle install

としたものをherokuにデプロイするとうまくいきそうです


CC BY-SA 4.0
2019-07-04T02:07:51.813
56365
2019-07-04T02:07:51.813
205
56293
answer