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
2

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Do i have to reconfigurer my code for postgresql, or will it just work?
It will work, just make changes in gemfile, as suggested in my answer.
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...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.