我正在尝试将我的应用推送到heroku,但我一直在收到错误。我看到heroku不支持sqlite3,我从gem文件中删除它,然后捆绑。我的database.yml文件正在使用postgresql。也许其他东西试图使用sqlite?我该如何解决这个问题?以下是以下命令后heroku的日志。
$git push heroku master
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.4
-----> Installing dependencies using bundler 1.11.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.8.0
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.5
Installing builder 3.2.2
Installing erubis 2.7.0
Installing mini_portile 0.6.2
Installing rack 1.6.4
Installing arel 6.0.3
Installing coffee-script-source 1.9.1.1
Installing mime-types 2.6.1
Installing thor 0.19.1
Installing execjs 2.6.0
Using bundler 1.11.2
Using rdoc 4.2.0
Installing multi_json 1.11.2
Installing tilt 1.4.1
Installing sass 3.4.18
Installing sqlite3 1.3.10 with native extensions
Installing tzinfo 1.2.2
Installing nokogiri 1.6.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20161013-219-al82rl.rb 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_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.10/gem_make.out
Installing rack-test 0.6.3
Installing sprockets 3.3.3
Installing mail 2.6.3
Installing coffee-script 2.4.1
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/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.8.0
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.5
Installing builder 3.2.2
Installing erubis 2.7.0
Installing mini_portile 0.6.2
Installing rack 1.6.4
Installing arel 6.0.3
Installing coffee-script-source 1.9.1.1
Installing mime-types 2.6.1
Installing thor 0.19.1
Installing execjs 2.6.0
Using bundler 1.11.2
Using rdoc 4.2.0
Installing multi_json 1.11.2
Installing tilt 1.4.1
Installing sass 3.4.18
Installing sqlite3 1.3.10 with native extensions
Installing tzinfo 1.2.2
Installing nokogiri 1.6.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20161013-219-al82rl.rb 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_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.10/gem_make.out
Installing rack-test 0.6.3
Installing sprockets 3.3.3
Installing mail 2.6.3
Installing coffee-script 2.4.1
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.
! Push failed
这是我的database.yml文件
development:
adapter: postgresql
encoding: utf8
database: db/development
host: localhost
pool: 5
timeout: 5000
username: sfinley
password: password
test:
adapter: postgresql
encoding: utf8
database: db/test
pool: 5
timeout: 5000
username: sfinley
password: password
production:
adapter: postgresql
encoding: utf8
database: db/production
pool: 5
timeout: 5000
username: sfinley
password: password
这是我的宝石文件
source 'https://rubygems.org'
# http://ifyouseeit.org/blog/2013/08/07/switch-db-from-sqlite3-to-postgres-in-rails-app/
gem 'pg'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# 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'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
答案 0 :(得分:0)
我之前在similar post回答了这个问题。做一个简单的搜索就可以得到答案,而不是马上询问。无论如何,这是解决方案。
只需在你的Gemfile中执行此操作
group :production do
gem 'pg'
gem 'rails_12factor'
end
并将您的sqlite3 gem转移到
group :development, :test do
gem 'sqlite3'
end
运行bundle install --without production
,你应该好好去。在尝试推送到Heroku之前,请记得将新代码推送到git。