Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removed sqlite gem but Heroku still detects sqlite gem and fails

I am trying to deploy a rails app to heroku and I am getting the following error.

Detected sqlite3 gem which is not supported on Heroku

I have removed any reference to sqlite3 from my project and converted it to use 'pg', updated the Gemfile.lock and committed it but the error persists.

Here is my gemfile

source 'https://rubygems.org'

group :test, :development do
  #testing
  gem 'rspec-rails', '~ 3.0'
  gem 'factory_girl_rails', '~ 4.0'
  gem 'guard-rspec', require: false
  gem 'faker'
  gem 'database_cleaner'
end

# Use postgres as the database for Active Record
gem 'pg'
gem 'rails_12factor'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'

# Use SCSS for stylesheets
gem 'sass-rails', '~ 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~ 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~ 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~ 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring',        group: :development

# Use ActiveModel has_secure_password
#gem 'bcrypt', '~ 3.1.7'

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

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

ruby '2.0.0'

Here is my database.yml

development:
  adapter: postgresql
  encoding: SQL_ASCII
  database: rock_development
  pool: 5


test:
  adapter: postgresql
  encoding: SQL_ASCII
  database: rock_test
  pool: 5

Here is my heroku log

ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Installing i18n 0.6.11
       Installing rake 10.3.2
       Installing minitest 5.4.2
       Installing thread_safe 0.3.4
       Installing builder 3.2.2
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing json 1.8.1
       Installing mime-types 1.25.1
       Installing polyglot 0.3.5
       Installing arel 5.0.1.20140414130214
       Installing coffee-script-source 1.8.0
       Installing execjs 2.2.2
       Installing thor 0.19.1
       Installing hike 1.2.3
       Using bundler 1.6.3
       Installing multi_json 1.10.1
       Installing tilt 1.4.1
       Installing sass 3.2.19
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_29a41245e46646e56496208f95c41c97/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for sqlite3.h... no
       sqlite3.h is missing. Try 'port install sqlite3 +universal',
       'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
       and check your shared library search path (the
       location where your sqlite3 shared library is located).
       *** extconf.rb failed ***
       Could not create Makefile due to some reason, probably lack of necessary
       libraries and/or headers.  Check the mkmf.log file for more details.  You may
       need configuration options.
       Provided configuration options:
       --with-opt-dir
       --without-opt-dir
       --with-opt-include
       --without-opt-include=${opt-dir}/include
       --with-opt-lib
       --without-opt-lib=${opt-dir}/lib
       --with-make-prog
       --without-make-prog
       --srcdir=.
       --curdir
       --ruby=/tmp/build_29a41245e46646e56496208f95c41c97/vendor/ruby-2.0.0/bin/ruby
       --with-sqlite3-dir
       --without-sqlite3-dir
       --with-sqlite3-include
       --without-sqlite3-include=${sqlite3-dir}/include
       --with-sqlite3-lib
       --without-sqlite3-lib=${sqlite3-dir}/
       --enable-local
       --disable-local
       Gem files will remain installed in /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
       Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
       Installing tzinfo 1.2.2
       Installing bcrypt 3.1.7
       An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
       Bundler Output: Fetching gem metadata from https://rubygems.org/.........
       Installing i18n 0.6.11
       Installing rake 10.3.2
       Installing minitest 5.4.2
       Installing thread_safe 0.3.4
       Installing builder 3.2.2
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing json 1.8.1
       Installing mime-types 1.25.1
       Installing polyglot 0.3.5
       Installing arel 5.0.1.20140414130214
       Installing coffee-script-source 1.8.0
       Installing execjs 2.2.2
       Installing thor 0.19.1
       Installing hike 1.2.3
       Using bundler 1.6.3
       Installing multi_json 1.10.1
       Installing tilt 1.4.1
       Installing sass 3.2.19

       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

       /tmp/build_29a41245e46646e56496208f95c41c97/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for sqlite3.h... no
       sqlite3.h is missing. Try 'port install sqlite3 +universal',
       'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
       and check your shared library search path (the
       location where your sqlite3 shared library is located).
       *** extconf.rb failed ***
       Could not create Makefile due to some reason, probably lack of necessary
       libraries and/or headers.  Check the mkmf.log file for more details.  You may
       need configuration options.

       Provided configuration options:
       --with-opt-dir
       --without-opt-dir
       --with-opt-include
       --without-opt-include=${opt-dir}/include
       --with-opt-lib
       --without-opt-lib=${opt-dir}/lib
       --with-make-prog
       --without-make-prog
       --srcdir=.
       --curdir
       --ruby=/tmp/build_29a41245e46646e56496208f95c41c97/vendor/ruby-2.0.0/bin/ruby
       --with-sqlite3-dir
       --without-sqlite3-dir
       --with-sqlite3-include
       --without-sqlite3-include=${sqlite3-dir}/include
       --with-sqlite3-lib
       --without-sqlite3-lib=${sqlite3-dir}/
       --enable-local
       --disable-local


       Gem files will remain installed in /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
       Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
       Installing tzinfo 1.2.2
       Installing bcrypt 3.1.7
       An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.9'` 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 app
like image 588
AshenFox Avatar asked Jan 09 '23 09:01

AshenFox


1 Answers

Problem solved. It was actually a problem with how I was using git. I had created a new branch to make the changes from sqlite to ppsql and I was trying to push to heroku from that branch. Turns out when you say "git push heroku master" it isn't pushing from your current branch, it is pushing from the master branch. Which in my case was still configured to use sqlite. To solve this problem first merge with your master branch before pushing to heroku.

like image 105
AshenFox Avatar answered Jan 23 '23 18:01

AshenFox