git push heroku masterでのエラー(Ruby on Railsチュートリアル)
はじめに
Ruby on Railsチュートリアル実施時に詰まった場所です。
terminal
$ git push heroku master
Herokuにpushする。
terminal
remote: In Gemfile:
remote: sqlite3
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: ! Detected sqlite3 gem which is not supported on Heroku:
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to gentle-escarpment-12983.
remote:
To https://git.heroku.com/gentle-escarpment-12983.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/gentle-escarpment-12983.git'
エラーをはきます。(ログからsqlite3のgemがうまくいってなさそう・・・)
解決方法
以下にsqlite3を追加。
Gemfile
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
以下にpgを追加。
Gemfile
group :production do
gem 'pg', '0.20.0'
end
これで再度、以下を実施でHerokuへのpushは完了。
terminal
$ bundle install --without production
$ git push heroku master