[Heroku][Rails] Always Run bundle install After Editing Gemfile
When developing with Heroku + Rails, if you remove unnecessary gems from the Gemfile, always run bundle install.
The procedure when editing Gemfile is as follows:
1. Add gems to Gemfile (or remove unnecessary gems)
bundle install
git add, git commit
git push heroku master
If you don’t run bundle install, the contents of the Gemfile.lock file won’t be updated, so even if you git push, you’ll get an error like the following:
$ git push heroku master
Counting objects: 17, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 714 bytes, done.
Total 9 (delta 7), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.rc
Running: bundle install --without development:test --path vendor/bundle --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.
You have deleted from the Gemfile:
* bootstrap-sass (= 1.4.0)
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To [email protected]:xxxxxx.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:xxxxxx.git'
That’s all from the Gemba about remembering to always run bundle install after editing the Gemfile.