Trying to push Rails 3.2 app on Heroku sqlite3 error

I am trying to push my Rails app to Heroku but keep getting this error.

Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

      

This is my Gemfile

    source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'


  gem 'pg'
  gem 'thin'



# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'twitter-bootstrap-rails'


  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails', '~> 2.0.1'
gem 'modernizr-rails', '~> 2.0.6'
gem 'will_paginate', '~> 3.0.3'
gem 'simple_form', '~> 2.0.1'
gem 'friendly_id', '~> 4.0.4'

# Authentication
gem 'devise', '~> 2.0.4'
# gem 'recaptcha', :require => 'recaptcha/rails'

# Authorisation 
gem 'cancan', '~> 1.6.7'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

      

and this is my gemlock file

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.1)
      actionpack (= 3.2.1)
      mail (~> 2.4.0)
    actionpack (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.1)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.1)
      activesupport (= 3.2.1)
      builder (~> 3.0.0)
    activerecord (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
      arel (~> 3.0.0)
      tzinfo (~> 0.3.29)
    activeresource (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
    activesupport (3.2.1)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    arel (3.0.2)
    bcrypt-ruby (3.0.1)
    builder (3.0.0)
    cancan (1.6.7)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.2.0)
    commonjs (0.2.5)
    daemons (1.1.8)
    devise (2.0.4)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.3)
      railties (~> 3.1)
      warden (~> 1.1.1)
    erubis (2.7.0)
    eventmachine (0.12.10)
    execjs (1.3.0)
      multi_json (~> 1.0)
    friendly_id (4.0.4)
    hike (1.2.1)
    i18n (0.6.0)
    journey (1.0.3)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.6.6)
    less (2.1.0)
      commonjs (~> 0.2.0)
      therubyracer (~> 0.10.0)
    less-rails (2.2.0)
      actionpack (>= 3.1)
      less (~> 2.1.0)
    libv8 (3.3.10.4)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.18)
    modernizr-rails (2.0.6)
    multi_json (1.2.0)
    orm_adapter (0.0.7)
    pg (0.13.2)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.1)
      actionmailer (= 3.2.1)
      actionpack (= 3.2.1)
      activerecord (= 3.2.1)
      activeresource (= 3.2.1)
      activesupport (= 3.2.1)
      bundler (~> 1.0)
      railties (= 3.2.1)
    railties (3.2.1)
      actionpack (= 3.2.1)
      activesupport (= 3.2.1)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    sass (3.1.15)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    simple_form (2.0.1)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    sprockets (2.1.2)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    therubyracer (0.10.0)
      libv8 (~> 3.3.10)
    thin (1.3.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    twitter-bootstrap-rails (2.0.5)
      actionpack (>= 3.1)
      less-rails (~> 2.2.0)
      railties (>= 3.1)
    tzinfo (0.3.32)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    warden (1.1.1)
      rack (>= 1.0)
    will_paginate (3.0.3)

PLATFORMS
  ruby

DEPENDENCIES
  cancan (~> 1.6.7)
  coffee-rails (~> 3.2.1)
  devise (~> 2.0.4)
  friendly_id (~> 4.0.4)
  jquery-rails (~> 2.0.1)
  modernizr-rails (~> 2.0.6)
  pg
  rails (= 3.2.1)
  sass-rails (~> 3.2.3)
  simple_form (~> 2.0.1)
  thin
  twitter-bootstrap-rails
  uglifier (>= 1.0.3)
  will_paginate (~> 3.0.3)

      

I have no links to sqlite3 but it tries to install it anyway. I removed gemfile.lock and Bundle install'd, then git add + commit several times. Where am I going wrong? Many thanks!

+3


source to share


3 answers


I would suggest using groups for your PostgreSQL gem. I'm not sure why it is trying to install sqlite3, but it might fix it.



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

      

+3


source


I also had a situation where Rails didn't seem to choose which db engine to use depending on how I configured the Gemfile.

If you are on Mac OS X or Linux, check your environment variables to see if you have one called "DATABASE_URL". In my case, the Gemfile indicated sqlite3, but I could tell that Rails is using Postgres and I had no idea why until I came across an environment variable configured with PostgreSQL info.



I will also follow Adam's advice and create groups.

+1


source


Make sure in what environment you are going to use the database. You are trying to use PostgreSQL, but you are not deciding what environment you use it in. so create a group in the gem file to use it. for example

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

      

0


source







All Articles