0

I have been trying to push to Heroku but this error stopped me from advancing further.

In the beginning, it says: remote:Your Gemfile lists the gem sqlite3 (>= 0) more than once.

But afterwards:

remote:        Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.       
remote:        /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/ruby-2.0.0/bin/ruby extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'port install sqlite3 +universal',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:        
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/ruby-2.0.0/bin/ruby
remote:        --with-sqlite3-dir
remote:        --without-sqlite3-dir
remote:        --with-sqlite3-include
remote:        --without-sqlite3-include=${sqlite3-dir}/include
remote:        --with-sqlite3-lib
remote:        --without-sqlite3-lib=${sqlite3-dir}/
remote:        Gem files will remain installed in /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
remote:        Results logged to /tmp/build_d6d0f05e8da9cbfba1689173eab3d2d0/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
remote:  !     Detected sqlite3 gem which is not supported on Heroku.
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app

I have tried installing postgres and doing this in the Gemfile:

gem 'sqlite3', group: [:development, :test]
gem 'pg', group: [:production]

Nothing is working, and I am starting to give up on Rails..

David Kim
  • 29
  • 3
  • Okay buddy, calm down.. try `bundle install --without production` then commit your changes then finally push to Heroku. Let me know what happens. – Ojash Jul 11 '15 at 12:03
  • 2
    For what it's worth, I think it's a terrible idea developing with sqlite then pushing to PostgreSQL. I'd start with Postgres.app for local development. – Craig Ringer Jul 11 '15 at 13:42
  • @Ojash Oh my goodness. IT IS WORKING! Thank you so much! Does this mean I have to `bundle install --without production` every time I try to push? – David Kim Jul 12 '15 at 04:40
  • if you install `postgresql` in your local also, you don't have to do that, just `bundle install` will work. What I guessed is you forgot to commit your changes after you did `bundle install`. you need to commit everything before pushing to heroku. – Ojash Jul 12 '15 at 12:29

1 Answers1

0

I highly recommend using postgres on your local machine too. If you develop in sqlite3 and use Heroku (postgres), you'll eventually run into issues that sqlite3 will accept but postgres rejects, since postgres is more restrictive. Means something you did to the database works locally, but will error out on heroku, thus causing lots of anger/frustration. Additionally, it's nice to have the same database on heroku and localhost. If they're both running postgres you can push and pull copies to/from localhost/heroku. That way you are always using the same information.

Anyways, here is how my gem file looks, which I believe is the default.

Gemfile

 source 'https://rubygems.org'

  #gems for both development and production here

 group :development, :test do
  #gems for only development here
 end

 group :production do
  #gems for only production here

 end
nonegiven72
  • 427
  • 8
  • 19