简体   繁体   中英

git push heroku master: Error occurred while installing sqlite3

I'm going crazy with this problem.

I'm new in Heroku and today I was trying deploy my app, but I couldn't.I could build it once, but it gave me an "internal server error ".

Error:

When I run git push heroku master , after do the commit, it returns:

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using 1.7.12
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
       Fetching gem metadata from https://rubygems.org/.........
       Resolving dependencies...
       Using json 1.8.2
       Using i18n 0.7.0
       ...
       Using sass-rails 5.0.3
       Using turbolinks 2.5.3
       Installing bootstrap-sass 3.2.0.2
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/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_4e3945a34652ba20ca13b13d160a9dd7/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}/
       Gem files will remain installed in /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
       Results logged to /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
       An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
       continue.
       Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
       Bundler Output: Fetching gem metadata from https://rubygems.org/.........
       Resolving dependencies...
       Using json 1.8.2
       Using i18n 0.7.0
       ...
       Using sass-rails 5.0.3
       Using turbolinks 2.5.3
       Installing bootstrap-sass 3.2.0.2

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

       /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/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_4e3945a34652ba20ca13b13d160a9dd7/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}/

       Gem files will remain installed in /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
       Results logged to /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
       An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
       continue.
       Make sure that `gem install sqlite3 -v '1.3.10'` 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

Forgive me if it's a simple mistake. But it is getting me a headache.

Resolved

Mistake: I didn't know I must commit the changes.

  1. git commit -am "comment line"
  2. git push
  3. git push heroku master

That's all. Thanks, @suslov

As stated in your error code, Heroku doesn't support sqlite3 gem:

Detected sqlite3 gem which is not supported on Heroku.

so you can't use SQLite database and should remove from your Gemfile this line:

gem 'sqlite3'

Instead Heroku supports pg gem to run your application on PostgreSQL RDBMS so you should add the following line to the Gemfile :

gem 'pg'

Then run bundle install .

And in the config/database.yml change your RDBMS settings:

default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  database: db/development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: db/test

production:
  <<: *default
  database: db/production

After that you should commit all changes and finally run:

git push heroku master

Are you trying to push from a local repository to hosted? Before you push I think you will have to establish a relationship by typing.

$ git remote add [alias] [url] If you got the repository with git clone, then type $git push heroku master and type $ git push again without heroku master. I hope this answers your question.

I may help you :

group :production do
  gem 'pg'
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM