0

I am really bugged with a problem with Heroku. I am a total newbie and I have already tried out a few solutions and they don't seem to help me. Here is the error i get on using

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

in the gem file this is the entry i have for sqlite 3

Gem files will remain installed in /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to /tmp/build_2i8tok6rv3gyk/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
   An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
!
!     Failed to install gems via Bundler.
!     
!     Detected sqlite3 gem which is not supported on Heroku.
!     https://devcenter.heroku.com/articles/sqlite3
!
!     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:glacial-wildwood-5205.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:glacial-wildwood-5205.git'
Aravind
  • 1,391
  • 1
  • 16
  • 41

2 Answers2

1

heroku does not support sqlite3 , use Postgresql instead.

group :development do
   gem 'sqlite3'
end

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

In this way sqlite will be your local db , and postgres will be for test and production

Rob Allen
  • 17,381
  • 5
  • 52
  • 70
sunny1304
  • 1,684
  • 3
  • 17
  • 30
  • how do i remove sqlite3 and add postgresql? – Aravind Jun 27 '13 at 17:27
  • `Gem files will remain installed in /home/aravind/.bundler/tmp/15662/gems/pg-0.12.2 for inspection. Results logged to /home/aravind/.bundler/tmp/15662/gems/pg-0.12.2/ext/gem_make.out An error occurred while installing pg (0.12.2), and Bundler cannot continue. Make sure that `gem install pg -v '0.12.2'` succeeds before bundling` This is the error i get when i did what you said. Please help. – Aravind Jun 27 '13 at 18:08
  • also note that you may have to update some models to work properly in postgre – Rob Allen Jun 27 '13 at 18:08
  • 1
    Hmm.. looks like you might need to install postgres? Check this question -> http://stackoverflow.com/questions/11439207/rails-error-installing-pg-gem – Mike Vormwald Jun 27 '13 at 22:32
1

You'll want to change your Gemfile

add gem 'pg' to your production group

group :production do
  gem "pg"
end

Then be sure to run bundle install before you commit to heroku

This whole guide should help get you started: https://devcenter.heroku.com/articles/ruby#using-a-sql-database

Mike Vormwald
  • 2,280
  • 22
  • 29