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

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

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

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

Heroku

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

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

Q&A

1回答

1857閲覧

git push heroku master をするとエラー

osuzumaru

総合スコア9

Git

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

Heroku

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

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

0グッド

0クリップ

投稿2020/05/15 02:00

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'

この件に関して改善策わかる方いましたらご教授お願いします

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

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

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

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

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

hoshi-takanori

2020/05/16 17:30

Gemfile に pg が追加されているが、それが Gemfile.lock に反映されてないと言ってますね。
osuzumaru

2020/05/16 17:34

無事、デプロイすることができました! ありがとうございました!!
guest

回答1

0

Herokuへのデプロイは元簡単です。

以下の記事を参考にしてみてください。

https://asalworld.com/heroku-deploy/

投稿2021/12/29 17:21

退会済みユーザー

退会済みユーザー

総合スコア0

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問