Cannot deploy rails app to Heroku

heroku rails 6
deploy rails 6 app to heroku
heroku rails logs
heroku assets:precompile rails 5
heroku rails/webpacker
rails 6 credentials heroku
admin heroku
heroku android app

I'm trying to deploy my rails app to heroku, but due to constant errors when I do "git push heroku master," I've been unable to do it.The error appears this way:

$ git push heroku master
Counting objects: 8942, done.

Delta compression using up to 4 threads.
Compressing objects: 100% (8320/8320), done.
Writing objects: 100% (8942/8942), 38.02 MiB | 1.59 MiB/s, done.
Total 8942 (delta 1019), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     Warning: Multiple default buildpacks reported the abi
lity 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/art
icles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.7
remote: -----> 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 o
lder than the version that created the lockfile (1.16.1). We suggest
 you upgrade to the latest version of Bundler by running `gem instal
l bundler`.
remote:        Fetching gem metadata from https://rubygems.org/.....
...
remote:        Fetching version metadata from https://rubygems.org/.
.
remote:        Fetching dependency metadata from https://rubygems.or
g/.
remote:        Fetching rake 12.3.1
remote:        Fetching concurrent-ruby 1.0.5
remote:        Fetching minitest 5.11.3
remote:        Installing rake 12.3.1
(...)
remote:        Installing activesupport 5.1.6
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem nati
ve extension.
remote:
remote:        current directory:
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/ru
by-2.3.7/bin/ruby -r
remote:        ./siteconf20180513-253-1utdlov.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 libsql
ite3-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, probabl
y lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file fo
r 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:         --srcdir=.

remote:         --curdir
remote:        --ruby=/tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/ve
ndor/ruby-2.3.7/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 c
heck the mkmf.log which can
remote:        be found here:
remote:
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.lo
g
remote:
remote:        extconf failed, exit code 1
remote:
remote:        Gem files will remain installed in
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_mak
e.out
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'` succ
eeds before bundling.
remote:
remote:        In Gemfile:
remote:          sqlite3
remote:        Bundler Output: Warning: the running version of Bundl
er (1.15.2) is older than the version that created the lockfile (1.1
6.1). We suggest you upgrade to the latest version of Bundler by run
ning `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.or
g/.
remote:        Fetching rake 12.3.1
remote:        Fetching concurrent-ruby 1.0.5
(...)
remote:        Installing activesupport 5.1.6
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem nati
ve extension.
remote:
remote:        current directory:
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/ru
by-2.3.7/bin/ruby -r
remote:        ./siteconf20180513-253-1utdlov.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 libsql
ite3-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, probabl
y lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file fo
r 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_cffd92476daf50cbcc0ddddd7e5ac406/ve
ndor/ruby-2.3.7/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 c
heck the mkmf.log which can
remote:        be found here:
remote:
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.lo
g
remote:
remote:        extconf failed, exit code 1
remote:
remote:        Gem files will remain installed in
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_cffd92476daf50cbcc0ddddd7e5ac406/vendor/bu
ndle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_mak
e.out
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'` succ
eeds before bundling.
remote:
remote:        In Gemfile:
remote:          sqlite3
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 XXXXX.
remote:
To https://git.heroku.com/XXXXX.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/XXXXX.git'

My Gemfile is below [updated]:

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', '~> 5.1.6'

group :production do
  gem 'pg'
end

# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 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', '~> 2.13'
  gem 'selenium-webdriver'

  gem 'pry-rails'  
  gem 'pry-doc'    
  gem 'pry-byebug' 
  gem 'pry-stack_explorer' 
  gem 'hirb'         
  gem 'hirb-unicode' 
  gem 'better_errors'
  gem "binding_of_caller"

  # Use sqlite3 as the database for Active Record
  gem 'sqlite3', require: false
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 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', '~> 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]

gem 'devise'

gem 'omniauth-facebook'

gem 'dotenv-rails', require: 'dotenv/rails-now'

gem 'thin'

gem 'carrierwave'

gem 'rails-erd'

gem 'jquery-rails'

I'm a beginner developer of ruby-on-rails and totally at a loss what to do to fix this problem. Any help is so appreciated!


First, make sure you have the gemfile right, it should be something like this:

group :production do  
  gem 'pg'
end

run

bundle install

Editin config/database.yml

development:
 adapter: sqlite3
 database: db/development.sqlite3
 pool: 5
 timeout: 5000

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_database_production
  pool: 5
  timeout: 5000

And finally commit the changes

git commit -am 'changes'

upload the changes to heroku

git push heroku master

Make sure you create the bd in heroku

heroku addons:create heroku-postgresql

this article can help you https://devcenter.heroku.com/articles/sqlite3

Getting Started on Heroku with Rails 6.x, Creating, configuring, deploying and scaling Rails 6.x applications on Heroku, using Create a new Rails app (or upgrade an existing one) is recommended instead of Sqlite3, see why you cannot use Sqlite3 on Heroku. In order to deploy to Heroku, you need to have an account with them. If you don’t have one already, click here to sign up. Now, Heroku has their instructions to deploy a rails app here. I found the instructions to be pretty clear, and it may be all you need.


Documented on Heroku's website. (https://devcenter.heroku.com/articles/sqlite3#getting-a-sqlite-error-even-though-it-is-not-in-the-gemfile). Your database.yml should look like this:

development:
 adapter: postgresql
 database: my_database_development
 pool: 5
 timeout: 5000

test:
 adapter: postgresql
 database: my_database_test
 pool: 5
 timeout: 5000

production:
 adapter: postgresql
 database: my_database_production
 pool: 5
 timeout: 5000

After making those changes make sure to run the following commands:

rake db:create
rake db:migrate

Now you need to git add and git commit -m postgres. In the event you are still getting an error after trying all these steps, you may have to get your hands dirty and do some investigating as one of the gems you have in your gemfile could very well be using SQL as a dependency. Start with looking in your Gemfile.lock. Please see below:

Getting a SQLite error even though it is not in the Gemfile: If you’ve removed the gem 'sqlite3' line from your Gemfile and are still getting errors while deploying to Heroku it is likely that another gem you are using has sqlite3 as a dependency. To help find the source of this dependency look in your Gemfile.lock for sqlite3. Find the gem that has sqlite3 as a dependency and remove it from your Gemfile. Once you’ve done this run bundle install and ensure that sqlite3 no longer exists in your Gemfile.lock.

Hope that helps.

Cannot deploy rails app to Heroku, First, make sure you have the gemfile right, it should be something like this: group :production do gem 'pg' end. run. bundle install. Type this in the terminal:heroku run rails db:migrate. This tells Heroku to run your migrations on its database, like running rails db:migrate locally. Heroku's database is separate from the one on your computer, which means it needs to be updated every time you make changes to the structure of your database.


Oh finally it turns out that the problem has been solved! I was in a development branch of my git and when I merged it into master and conducted git push heroku master, it went well. I hadn't realized the problem was caused by an easy factor until I read below. Thank you so much for your help!

c.f. Heroku installing sqlite3 even though it is not a dependecy

Deploying a Rails App with Heroku, When creating your rails application, the default is to work with SQLite for your database. The problem is that Heroku applications work better  Now that your application is committed to Git you can deploy to Heroku. Deploy your application to Heroku. Make sure you are in the directory that contains your Rails app, then create an app on Heroku:


Rails Deploy to Heroku · railsguides, Here's how to deploy a Rails application on Heroku. You may see a message, "​The authenticity of host 'heroku.com' can't be established. There are several options for invoking the Rails asset pipeline when deploying to Heroku. For general information on the asset pipeline please see the Rails 3.1+ Asset Pipeline on Heroku Cedar article. The config.assets.initialize_on_precompile option has been removed is and not needed for Rails 5.


Deploy Rails to Heroku, This is called deploying your app. Heroku is a popular hosting service that is free to start using. Here's how to deploy your Rails app to Heroku. Rails Asset Pipeline. There are several options for invoking the Rails asset pipeline when deploying to Heroku. For general information on the asset pipeline please see the Rails 3.1+ Asset Pipeline on Heroku Cedar article. The config.assets.initialize_on_precompile option has been removed is and not needed for Rails 4.


deployment of rails app on heroku not working, deployment of rails app on heroku not working. so close to finishing In most cases there's just problem with glyphicons. Google out how to  If this occurs, the different versions of your app will be deployed to Heroku in the order in which their respective builds complete. Note that this can differ from the order in which the pushes occurred. For example, consider two builds, A and B. If Build B starts after Build A but finishes before it,