1

I'm trying to deploy my application to Heroku and it's failing. I get this error:

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.

This is my Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.5'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
#Authentication Gem -> https://github.com/thoughtbot/clearance
gem 'clearance', '~> 1.16.1'
gem 'bootstrap'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
#Gem for search
#https://github.com/karmi/retire
gem 'tire'
gem 'simple_form', '~> 3.4'
gem 'jquery-turbolinks'
gem "chartkick"

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • 2
    [Why is SQLite a bad fit for running on Heroku?](https://devcenter.heroku.com/articles/sqlite3). – Sebastián Palma Mar 31 '18 at 19:37
  • Possible duplicate of [Heroku deployment failed because of sqlite3 gem error](https://stackoverflow.com/questions/13083399/heroku-deployment-failed-because-of-sqlite3-gem-error) – Mike Szyndel Mar 31 '18 at 20:37

2 Answers2

2

Heroku does not support SQLite3. You can use PostgreSQL instead.

Add sqlite3 only for development:

group :development do
   gem 'sqlite3'
end

group :test, :production do
    gem 'pg'
end

Then run bundle install before committing the changes.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Ganesh
  • 1,924
  • 1
  • 18
  • 31
0

Ganesh started you off right... in addition to updating your gemfile, you'll also want to edit your config/database.yml

Gemfile =>

group :development, :test do
   gem 'sqlite3'
end

group :production do
    gem 'pg'
end

config/database.yml =>

default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

test:
  <<: *default
  database: db/test.sqlite3

production:
  adapter: postgresql
  encoding: unicode
  host: localhost 
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  database: sample_production
  username: sample
  password: <%= ENV['SAMPLE_DATABASE_PASSWORD'] %>

where SAMPLE is usually the name of your app...

ohiodn8
  • 46
  • 5