LoginSignup
0
0

More than 3 years have passed since last update.

Gemfile.lockがなぜかコミットされていなくてHerokuでビルドできなかった

Posted at

Railsチュートリアルで嵌ったので備忘録的に書いていきます。

Herokuでビルドに失敗する

Railsチュートリアルの指示に従い下記コマンドを実行する。

git push heroku master

HerokuをのぞいてみるとBuild failedが表示されている。
チュートリアルに従っているのになぜ・・・と思いつつビルドログを除くと

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.6
-----> Installing dependencies using bundler 1.17.3
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   You are trying to install in deployment mode after changing
   your Gemfile. Run `bundle install` elsewhere and add the
   updated Gemfile.lock to version control.

   The dependencies in your gemfile changed

   You have added to the Gemfile:
   * pg (= 0.20.0)
   Bundler Output: You are trying to install in deployment mode after changing
   your Gemfile. Run `bundle install` elsewhere and add the
   updated Gemfile.lock to version control.

   The dependencies in your gemfile changed

   You have added to the Gemfile:
   * pg (= 0.20.0)
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

update Gemfile.lockとあるのでGemfile.lockを確認してみることに

Gemfile.lockがコミットされていなかった

git statusを実行してみる。
どうやらGemfile.lockがコミットされていないようだ。
ステージングエリアに移行するときは以下のコマンドを実行しているので、なぜ漏れているのかは分からない。。。

  git add -A

Gemfile.lockをコミットしたら、ビルドに成功しました。

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