我正在尝试将rails应用程序部署到heroku,我收到以下错误。
检测到Heroku不支持的sqlite3 gem
我从项目中删除了对sqlite3的任何引用,并将其转换为使用'pg',更新了Gemfile.lock并提交了它,但错误仍然存在。
这是我的宝石文件
source 'https://rubygems.org'
group :test, :development do
#testing
gem 'rspec-rails', '~ 3.0'
gem 'factory_girl_rails', '~ 4.0'
gem 'guard-rspec', require: false
gem 'faker'
gem 'database_cleaner'
end
# Use postgres as the database for Active Record
gem 'pg'
gem 'rails_12factor'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use SCSS for stylesheets
gem 'sass-rails', '~ 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~ 4.0.0'
# See https://github.com/sstephenson/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
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring', group: :development
# 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
# Use debugger
# gem 'debugger', group: [:development, :test]
ruby '2.0.0'
这是我的database.yml
development:
adapter: postgresql
encoding: SQL_ASCII
database: rock_development
pool: 5
test:
adapter: postgresql
encoding: SQL_ASCII
database: rock_test
pool: 5
这是我的heroku日志
ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/.........
Installing i18n 0.6.11
Installing rake 10.3.2
Installing minitest 5.4.2
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Installing rack 1.5.2
Installing json 1.8.1
Installing mime-types 1.25.1
Installing polyglot 0.3.5
Installing arel 5.0.1.20140414130214
Installing coffee-script-source 1.8.0
Installing execjs 2.2.2
Installing thor 0.19.1
Installing hike 1.2.3
Using bundler 1.6.3
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing sass 3.2.19
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/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}/
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
Installing tzinfo 1.2.2
Installing bcrypt 3.1.7
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/.........
Installing i18n 0.6.11
Installing rake 10.3.2
Installing minitest 5.4.2
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Installing rack 1.5.2
Installing json 1.8.1
Installing mime-types 1.25.1
Installing polyglot 0.3.5
Installing arel 5.0.1.20140414130214
Installing coffee-script-source 1.8.0
Installing execjs 2.2.2
Installing thor 0.19.1
Installing hike 1.2.3
Using bundler 1.6.3
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing sass 3.2.19
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/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}/
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
Installing tzinfo 1.2.2
Installing bcrypt 3.1.7
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` 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
答案 0 :(得分:3)
问题解决了。这实际上是我使用git的一个问题。我创建了一个新的分支来进行从sqlite到ppsql的更改,我试图从该分支推送到heroku。当你说" git push heroku master"它不是从你当前的分支推动,而是从主分支推出。在我的情况下仍然配置为使用sqlite。 要解决此问题,请在推送到heroku之前先与主分支合并。
答案 1 :(得分:2)
可能是由于您安装sqlite3 gem
时发生的,其版本详细信息将存储在 Gemfile.lock 中,因此请删除此文件,不要再烦恼,因为它会再次出现在您尝试在heroku上部署之后运行sqlite3 gem
时生成的bundle install
没有任何来源