rails (~> 5.2.3)
アプリケーションをherokuにデプロイする際に以下のエラーが表示されます。
エラー表示されるまでに行った内容としては
・Herokuのアカウントを作る
・
group :production do gem 'pg' end
・.database.ymlの修正
production: <<: *default adapter: postgresql encoding: unicode pool: 5
・GitHubに反映
・インストールコマンド実行
% brew tap heroku/brew && brew install heroku
・インストール完了後、herokuのバージョンを確認することで、herokuがインストールされているか確認。
% heloku -v zsh: command not found: heloku
・~/.zshrcにherokuコマンドのパスを追記します。
vim ~/.zshrc ~/.zshrcに以下を追記 export PATH=$PATH:/usr/local/Cellar/heroku/7.39.5/libexec/bin
・sourceコマンドでzshrcの内容を反映する。
% source ~/.zshrc
% heroku -v heroku/7.41.1 darwin-x64 node-v12.16.2
・PCからherokuにログインする
% heroku login heroku: Press any key to open up the browser to login or q to exit:
・ターミナルからの操作でHerokuのアプリを作ります
% heroku create アプリ名
・.git/configを修正することでエラーを回避できます。
% vim .git/config
・以下を追記することで"heroku"がどこのURLを指すのか指定します。
アプリ名は上述の「heroku create アプリ名」で作成したアプリを記述
[remote "heroku"] url = https://git.heroku.com/アプリ名.git fetch = +refs/heads/*:refs/remotes/heroku/*
・デプロイ。
% git push heroku master
すると以下エラー
my_app2 % git push heroku master Enumerating objects: 870, done. Counting objects: 100% (870/870), done. Delta compression using up to 4 threads Compressing objects: 100% (456/456), done. Writing objects: 100% (870/870), 798.55 KiB | 28.52 MiB/s, done. Total 870 (delta 500), reused 672 (delta 374), pack-reused 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: -----> Installing bundler 2.0.2 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.5.1 remote: -----> Installing dependencies using bundler 2.0.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * pg remote: Bundler Output: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * pg 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 myappoutput. remote: To https://git.heroku.com/myappoutput.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/myappoutput.git' Enumerating objects: 870, done. Counting objects: 100% (870/870), done. Delta compression using up to 4 threads Compressing objects: 100% (456/456), done. Writing objects: 100% (870/870), 798.55 KiB | 46.97 MiB/s, done. Total 870 (delta 500), reused 672 (delta 374), pack-reused 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: -----> Installing bundler 2.0.2 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.5.1 remote: -----> Installing dependencies using bundler 2.0.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * pg remote: Bundler Output: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * pg 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 outputmyapp. remote: To https://git.heroku.com/outputmyapp.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/outputmyapp.git'
この件に関して改善策わかる方いましたらご教授お願いします