Home>

I want to deploy a product developed with Ruby on Rails using Heroku, but I got an error and couldn't solve it by myself.

I will post the full text below, so I would be grateful if you could give me some advice.

The error message that is occurring
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby, Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
----->Ruby app detected
----->Installing bundler 1.17.3
----->Removing BUNDLED WITH version in the Gemfile.lock
----->Compiling Ruby/Rails
----->Using Ruby version: ruby-2.6.3
----->Installing dependencies using bundler 1.17.3
       Running: BUNDLE_WITHOUT ='development: test' BUNDLE_PATH = vendor/bundle BUNDLE_BIN = vendor/bundle/bin BUNDLE_DEPLOYMENT = 1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE = 1 bundle install -j4
       The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby ​​but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
       Fetching gem metadata from https://rubygems.org/............
       Fetching rake 13.0.1
       Installing rake 13.0.1<Omitted>     Fetching sass-rails 6.0.0
       Installing sass-rails 6.0.0
       Gem :: Ext :: BuildError: ERROR: Failed to build gem native extension.
       current directory:
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2/ext/sqlite3
       /tmp/build_b9010875_/vendor/ruby-2.6.3/bin/ruby -I
       /tmp/build_b9010875_/vendor/ruby-2.6.3/lib/ruby/2.6.0 -r
       ./siteconf20201126-275-1e3viuh.rb extconf.rb
       checking for sqlite3.h ... no
       sqlite3.h is missing. Try'brew install sqlite3',
       '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_b9010875_/vendor/ruby-2.6.3/bin/$(RUBY_BASE_NAME)--with-sqlcipher
           --without-sqlcipher
           --with-sqlite3-config
           --without-sqlite3-config
           --with-pkg-config
           --without-pkg-config
           --with-sqlcipher
           --without-sqlcipher
           --with-sqlite3-dir
           --without-sqlite3-dir
           --with-sqlite3-include
           --without-sqlite3-include = ${sqlite3-dir}/include
           --with-sqlite3-lib
           --without-sqlite3-lib = ${sqlite3-dir}/lib
       To see why this extension failed to compile, please check the mkmf.log which can
       be found here:
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/mkmf.log
       extconf failed, exit code 1
       Gem files will remain installed in
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2 for inspection.
       Results logged to
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/gem_make.out
       An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.4.2' --source' https://rubygems.org/'`
       succeeds before bundling.
       In Gemfile:
         sqlite3
       Bundler Output: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby ​​but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java . To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
       Fetching gem metadata from https://rubygems.org/............
       Fetching rake 13.0.1
       Installing rake 13.0.1<Omitted>     Fetching sass-rails 6.0.0
       Installing sass-rails 6.0.0
       Gem :: Ext :: BuildError: ERROR: Failed to build gem native extension.
       current directory:
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2/ext/sqlite3
       /tmp/build_b9010875_/vendor/ruby-2.6.3/bin/ruby -I
       /tmp/build_b9010875_/vendor/ruby-2.6.3/lib/ruby/2.6.0 -r
       ./siteconf20201126-275-1e3viuh.rb extconf.rb
       checking for sqlite3.h ... no
       sqlite3.h is missing. Try'brew install sqlite3',
       '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 mayneed 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_b9010875_/vendor/ruby-2.6.3/bin/$(RUBY_BASE_NAME)
           --with-sqlcipher
           --without-sqlcipher
           --with-sqlite3-config
           --without-sqlite3-config
           --with-pkg-config
           --without-pkg-config
           --with-sqlcipher
           --without-sqlcipher
           --with-sqlite3-dir
           --without-sqlite3-dir
           --with-sqlite3-include
           --without-sqlite3-include = ${sqlite3-dir}/include
           --with-sqlite3-lib
           --without-sqlite3-lib = ${sqlite3-dir}/lib
       To see why this extension failed to compile, please check the mkmf.log which can
       be found here:
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/mkmf.log
       extconf failed, exit code 1
       Gem files will remain installed in
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2 for inspection.
       Results logged to
       /tmp/build_b9010875_/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/gem_make.out
       An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.4.2' --source' https://rubygems.org/'`
       succeeds before bundling.
       In Gemfile:
         sqlite3
 !!
 ! 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.
 ! Push failed!
  • Answer # 1

    Getting Started on Heroku with Rails 6.x

    If you ’re using an existing app that was created without specifying --database = postgresql, you need to add the pg gem to your Rails project.
    gem'sqlite3'
    To this:
    gem'pg'

    Edit Gemfile and database.yml according to the above documentation