title: Heroku: Failed to install gems via Bundler - Trouble deploying to Heroku
body: <p>I've been trying to push my Rails app to Heroku for the last few hours using <code>git push heroku master</code> and have been running into problems. This is the output:</p>
  
  <pre><code>remote: Compressing source files... done.
  remote: Building source:
  remote: 
  remote:  !     Warning: Multiple default buildpacks reported the ability 
  to handle this app. The first buildpack in the list below will be used.
  remote:             Detected buildpacks: Ruby,Node.js
  remote:             See 
  https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
  remote: -----&gt; Ruby app detected
  remote: -----&gt; Compiling Ruby/Rails
  remote: -----&gt; Using Ruby version: ruby-2.4.4
  remote: -----&gt; Installing dependencies using bundler 1.15.2
  remote:        Running: bundle install --without development:test --path 
  vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
  remote:        Warning: the running version of Bundler (1.15.2) is older 
  than the version that created the lockfile (1.16.3). We suggest you 
  upgrade to the latest version of Bundler by running `gem install 
  bundler`.
  remote:        Fetching gem metadata from https://rubygems.org/.........
  remote:        Fetching version metadata from https://rubygems.org/..
  remote:        Fetching dependency metadata from https://rubygems.org/.
  remote:        Fetching rake 12.3.1
  remote:        Fetching concurrent-ruby 1.0.5
  remote:        Fetching minitest 5.11.3
  remote:        Installing minitest 5.11.3
  remote:        Installing rake 12.3.1
  remote:        Installing concurrent-ruby 1.0.5
  remote:        Fetching thread_safe 0.3.6
  remote:        Installing thread_safe 0.3.6
  remote:        Fetching builder 3.2.3
  remote:        Installing builder 3.2.3
  remote:        Fetching erubi 1.7.1
  remote:        Fetching mini_portile2 2.3.0
  remote:        Installing erubi 1.7.1
  remote:        Installing mini_portile2 2.3.0
  remote:        Fetching crass 1.0.4
  remote:        Fetching rack 2.0.5
  remote:        Installing crass 1.0.4
  remote:        Fetching nio4r 2.3.1
  remote:        Installing nio4r 2.3.1 with native extensions
  remote:        Installing rack 2.0.5
  remote:        Fetching websocket-extensions 0.1.3
  remote:        Installing websocket-extensions 0.1.3
  remote:        Fetching mini_mime 1.0.0
  remote:        Installing mini_mime 1.0.0
  remote:        Fetching arel 8.0.0
  remote:        Installing arel 8.0.0
  remote:        Fetching execjs 2.7.0
  remote:        Fetching bcrypt 3.1.12
  remote:        Installing execjs 2.7.0
  remote:        Installing bcrypt 3.1.12 with native extensions
  remote:        Fetching rb-fsevent 0.10.3
  remote:        Installing rb-fsevent 0.10.3
  remote:        Fetching ffi 1.9.25
  remote:        Installing ffi 1.9.25 with native extensions
  remote:        Using bundler 1.15.2
  remote:        Fetching chronic 0.10.2
  remote:        Installing chronic 0.10.2
  remote:        Fetching coffee-script-source 1.12.2
  remote:        Installing coffee-script-source 1.12.2
  remote:        Fetching method_source 0.9.0
  remote:        Installing method_source 0.9.0
  remote:        Fetching thor 0.20.0
  remote:        Installing thor 0.20.0
  remote:        Fetching orm_adapter 0.5.0
  remote:        Installing orm_adapter 0.5.0
  remote:        Fetching devise-bootstrapped 0.1.1
  remote:        Installing devise-bootstrapped 0.1.1
  remote:        Fetching multi_json 1.13.1
  remote:        Installing multi_json 1.13.1
  remote:        Fetching puma 3.12.0
  remote:        Installing puma 3.12.0 with native extensions
  remote:        Fetching tilt 2.0.8
  remote:        Installing tilt 2.0.8
  remote:        Fetching sqlite3 1.3.13
  remote:        Installing sqlite3 1.3.13 with native extensions
  remote:        Fetching turbolinks-source 5.1.0
  remote:        Installing turbolinks-source 5.1.0
  remote:        Fetching i18n 1.0.1
  remote:        Installing i18n 1.0.1
  remote:        Fetching tzinfo 1.2.5
  remote:        Installing tzinfo 1.2.5
  remote:        Fetching nokogiri 1.8.4
  remote:        Installing nokogiri 1.8.4 with native extensions
  remote:        Fetching websocket-driver 0.6.5
  remote:        Installing websocket-driver 0.6.5 with native extensions
  remote:        Fetching mail 2.7.0
  remote:        Installing mail 2.7.0
  remote:        Fetching rack-test 1.0.0
  remote:        Installing rack-test 1.0.0
  remote:        Fetching warden 1.2.7
  remote:        Installing warden 1.2.7
  remote:        Fetching sprockets 3.7.2
  remote:        Installing sprockets 3.7.2
  remote:        Fetching autoprefixer-rails 9.0.0
  remote:        Installing autoprefixer-rails 9.0.0
  remote:        Fetching uglifier 4.1.15
  remote:        Installing uglifier 4.1.15
  remote:        Fetching whenever 0.10.0
  remote:        Installing whenever 0.10.0
  remote:        Fetching coffee-script 2.4.1
  remote:        Installing coffee-script 2.4.1
  remote:        Fetching rb-inotify 0.9.10
  remote:        Installing rb-inotify 0.9.10
  remote:        Fetching turbolinks 5.1.1
  remote:        Installing turbolinks 5.1.1
  remote:        Fetching faker 1.9.1
  remote:        Installing faker 1.9.1
  remote:        Fetching activesupport 5.1.6
  remote:        Installing activesupport 5.1.6
  remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native 
  extension.
  remote:        
  remote:        current directory:
  remote:       
  remote:        /tmp/build_4bda83927de17e82c06097acea1b6b55/vendor/ruby- 
  2.4.4/bin/ruby -r
  remote:        ./siteconf20180718-265-17bd8cb.rb extconf.rb
  remote:        checking for sqlite3.h... no
  remote:        sqlite3.h is missing. Try 'brew install sqlite3',
  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_4bda83927de17e82c06097acea1b6b55/vendor/ruby- 
  2.4.4/bin/$(RUBY_BASE_NAME)
  remote:         --with-sqlite3-config
  remote:         --without-sqlite3-config
  remote:         --with-pkg-config
  remote:         --without-pkg-config
  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}/lib
  remote:        
  remote:        To see why this extension failed to compile, please check 
  the mkmf.log which can
  remote:        be found here:
  remote:        
  remote:        
  remote:        
  remote:        extconf failed, exit code 1
  remote:        
  remote:        Gem files will remain installed in
  remote:        
  remote:        for inspection.
  remote:        Results logged to
  remote:        
  remote:        
  remote:        An error occurred while installing sqlite3 (1.3.13), and 
  Bundler cannot
  remote:        continue.
  remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds 
  before bundling.
  remote:        
  remote:        In Gemfile:
  remote:          sqlite3
  remote:        Bundler Output: Warning: the running version of Bundler 
  (1.15.2) is older than the version that created the lockfile (1.16.3). 
  We suggest you upgrade to the latest version of Bundler by running `gem 
  install bundler`.
  remote:        Fetching gem metadata from https://rubygems.org/.........
  remote:        Fetching version metadata from https://rubygems.org/..
  remote:        Fetching dependency metadata from https://rubygems.org/.
  remote:        Fetching rake 12.3.1
  remote:        Fetching concurrent-ruby 1.0.5
  remote:        Fetching minitest 5.11.3
  remote:        Installing minitest 5.11.3
  remote:        Installing rake 12.3.1
  remote:        Installing concurrent-ruby 1.0.5
  remote:        Fetching thread_safe 0.3.6
  remote:        Installing thread_safe 0.3.6
  remote:        Fetching builder 3.2.3
  remote:        Installing builder 3.2.3
  remote:        Fetching erubi 1.7.1
  remote:        Fetching mini_portile2 2.3.0
  remote:        Installing erubi 1.7.1
  remote:        Installing mini_portile2 2.3.0
  remote:        Fetching crass 1.0.4
  remote:        Fetching rack 2.0.5
  remote:        Installing crass 1.0.4
  remote:        Fetching nio4r 2.3.1
  remote:        Installing nio4r 2.3.1 with native extensions
  remote:        Installing rack 2.0.5
  remote:        Fetching websocket-extensions 0.1.3
  remote:        Installing websocket-extensions 0.1.3
  remote:        Fetching mini_mime 1.0.0
  remote:        Installing mini_mime 1.0.0
  remote:        Fetching arel 8.0.0
  remote:        Installing arel 8.0.0
  remote:        Fetching execjs 2.7.0
  remote:        Fetching bcrypt 3.1.12
  remote:        Installing execjs 2.7.0
  remote:        Installing bcrypt 3.1.12 with native extensions
  remote:        Fetching rb-fsevent 0.10.3
  remote:        Installing rb-fsevent 0.10.3
  remote:        Fetching ffi 1.9.25
  remote:        Installing ffi 1.9.25 with native extensions
  remote:        Using bundler 1.15.2
  remote:        Fetching chronic 0.10.2
  remote:        Installing chronic 0.10.2
  remote:        Fetching coffee-script-source 1.12.2
  remote:        Installing coffee-script-source 1.12.2
  remote:        Fetching method_source 0.9.0
  remote:        Installing method_source 0.9.0
  remote:        Fetching thor 0.20.0
  remote:        Installing thor 0.20.0
  remote:        Fetching orm_adapter 0.5.0
  remote:        Installing orm_adapter 0.5.0
  remote:        Fetching devise-bootstrapped 0.1.1
  remote:        Installing devise-bootstrapped 0.1.1
  remote:        Fetching multi_json 1.13.1
  remote:        Installing multi_json 1.13.1
  remote:        Fetching puma 3.12.0
  remote:        Installing puma 3.12.0 with native extensions
  remote:        Fetching tilt 2.0.8
  remote:        Installing tilt 2.0.8
  remote:        Fetching sqlite3 1.3.13
  remote:        Installing sqlite3 1.3.13 with native extensions
  remote:        Fetching turbolinks-source 5.1.0
  remote:        Installing turbolinks-source 5.1.0
  remote:        Fetching i18n 1.0.1
  remote:        Installing i18n 1.0.1
  remote:        Fetching tzinfo 1.2.5
  remote:        Installing tzinfo 1.2.5
  remote:        Fetching nokogiri 1.8.4
  remote:        Installing nokogiri 1.8.4 with native extensions
  remote:        Fetching websocket-driver 0.6.5
  remote:        Installing websocket-driver 0.6.5 with native extensions
  remote:        Fetching mail 2.7.0
  remote:        Installing mail 2.7.0
  remote:        Fetching rack-test 1.0.0
  remote:        Installing rack-test 1.0.0
  remote:        Fetching warden 1.2.7
  remote:        Installing warden 1.2.7
  remote:        Fetching sprockets 3.7.2
  remote:        Installing sprockets 3.7.2
  remote:        Fetching autoprefixer-rails 9.0.0
  remote:        Installing autoprefixer-rails 9.0.0
  remote:        Fetching uglifier 4.1.15
  remote:        Installing uglifier 4.1.15
  remote:        Fetching whenever 0.10.0
  remote:        Installing whenever 0.10.0
  remote:        Fetching coffee-script 2.4.1
  remote:        Installing coffee-script 2.4.1
  remote:        Fetching rb-inotify 0.9.10
  remote:        Installing rb-inotify 0.9.10
  remote:        Fetching turbolinks 5.1.1
  remote:        Installing turbolinks 5.1.1
  remote:        Fetching faker 1.9.1
  remote:        Installing faker 1.9.1
  remote:        Fetching activesupport 5.1.6
  remote:        Installing activesupport 5.1.6
  remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native 
  extension.
  remote:        
  remote:        current directory:
  remote:        
  remote:        /tmp/build_4bda83927de17e82c06097acea1b6b55/vendor/ruby- 
  2.4.4/bin/ruby -r
  remote:        ./siteconf20180718-265-17bd8cb.rb extconf.rb
  remote:        checking for sqlite3.h... no
  remote:        sqlite3.h is missing. Try 'brew install sqlite3',
  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:        --
  remote:         --with-sqlite3-config
  remote:         --without-sqlite3-config
  remote:         --with-pkg-config
  remote:         --without-pkg-config
  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}/lib
  remote:        
  remote:        To see why this extension failed to compile, please check 
  the mkmf.log which can
  remote:        be found here:
  remote:        
  remote:        
  remote:        
  remote:        extconf failed, exit code 1
  remote:        
  remote:        Gem files will remain installed in
  remote:        
  remote:        for inspection.
  remote:        Results logged to
  remote:        
  remote:        
  remote:        An error occurred while installing sqlite3 (1.3.13), and 
  Bundler cannot
  remote:        continue.
  remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds 
  before bundling.
  remote:        
  remote:        In Gemfile:
  remote:          sqlite3
  remote: 
  remote:  !
  remote:  !     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.
  remote: 
  remote:  !     Push failed
  remote: Verifying deploy...
  remote: 
  remote: !   Push rejected to glacial-reaches-77008.
  remote: 
  To https://git.heroku.com/glacial-reaches-77008.git
  ! [remote rejected] master -&gt; master (pre-receive hook declined)
  </code></pre>
  
  <p>I've tried <code>bundle update</code> and <code>bundle install</code> again and ran <code>git push heroku master</code> but it still didn't do anything.</p>
  
  <p>I also tried delete my Gemfile.lock file, ran <code>bundle update</code> and <code>bundle install</code> again, <code>git add</code> and <code>git commit</code> and ran <code>git push heroku master</code> with no results.</p>
  
  <p>This is a copy of my Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  git_source(:github) do |repo_name|
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
    "https://github.com/#{repo_name}.git"
  end
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '~&gt; 5.1.4'
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
  # Use Puma as the app server
  gem 'puma', '~&gt; 3.7'
  # Use SCSS for stylesheets
  gem 'sass-rails', '~&gt; 5.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  
  gem 'bootstrap-sass', '~&gt; 3.3.7'
  gem 'jquery-rails'
  gem 'growlyflash'
  
  gem 'devise'
  gem 'devise-bootstrapped'
  gem 'whenever', require: false
  
  gem 'faker'
  
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.2'
  # Turbolinks makes navigating your web application faster. Read more: 
  https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~&gt; 5'
  # Build JSON APIs with ease. Read more: 
  https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.5'
  # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~&gt; 3.0'
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a 
    debugger console
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
    # Adds support for Capybara system testing and selenium driver
    gem 'capybara', '~&gt; 2.13'
    gem 'selenium-webdriver'
    gem 'pry-rails'
    gem 'binding_of_caller'
    gem 'better_errors'
  
  end
  
  group :development do
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; 
    anywhere in the code.
    gem 'web-console', '&gt;= 3.3.0'
    gem 'listen', '&gt;= 3.0.5', '&lt; 3.2'
    # Spring speeds up development by keeping your application running in 
    the background. Read more: https://github.com/rails/spring
    gem 'spring'
    gem 'spring-watcher-listen', '~&gt; 2.0.0'
  end
  
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
  </code></pre>
  
  <p>This is my .gitignore</p>
  
  <pre><code># See https://help.github.com/articles/ignoring-files for more about 
  ignoring files.
  #
  # If you find yourself ignoring temporary files generated by your text 
  editor
  # or operating system, you probably want to add a global ignore instead:
  #   git config --global core.excludesfile '~/.gitignore_global'
  
  # Ignore bundler config.
  /.bundle
  
  # Ignore the default SQLite database.
  /db/*.sqlite3
  /db/*.sqlite3-journal
  
  # Ignore all logfiles and tempfiles.
  /log/*
  /tmp/*
  !/log/.keep
  !/tmp/.keep
  
  /node_modules
  /yarn-error.log
  
  .byebug_history
  </code></pre>
  
  <p>I've also deleted my Gemfile.lock <code>rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock</code>, ran <code>bundle install``git add</code> and <code>git commit</code> and tried pushing it up to Heroku again with no luck.</p>