首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku因为SQLite3拒绝了我的git推送

Heroku因为SQLite3拒绝了我的git推送
EN

Stack Overflow用户
提问于 2016-08-01 20:48:45
回答 5查看 1.5K关注 0票数 0

Heroku一直拒绝我的推送,错误如下:

代码语言:javascript
复制
 Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
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.

我意识到这是一个常见的问题(我已经查看了其他线程)我已经尝试从我的Gemfile中删除sqlite3 gem,我运行了捆绑安装,并确保sqlite3 gem也在我的Gemfile.lock中(它确实是)。

我还去掉了database.yml中对sqlite3的所有引用,并将它们替换为Postgres:

代码语言:javascript
复制
#
default: &default
  adapter: postgresql
  encoding: unicode
  database: store_development
  pool: 5
  timeout: 5000

development:
    adapter: postgresql
    encoding: unicode
    database: store_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:
  adapter: postgresql
  encoding: unicode
  database: store_test

production:
  adapter: postgresql
  encoding: unicode
  database: store_development

我有什么建议吗?

这是我的gemfile:

源'https://rubygems.org

代码语言:javascript
复制
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# 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'
#bcrypt for for encrpytion
gem 'bcrypt', '~> 3.1', '>= 3.1.11'
#byebug
gem 'byebug', '~> 9.0', '>= 9.0.5'
# 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
#paperclip for easy upload management
gem 'paperclip', '~> 4.3', '>= 4.3.6'
#bootstrap-sass
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
#searchkick
gem 'searchkick', '~> 1.2', '>= 1.2.1'
#paginate
gem 'will_paginate', '~> 3.1'
#paginate for bootstrap
gem 'bootstrap-will_paginate', '~> 0.0.10'
#Carrierwave
#gem 'carrierwave'
#Cloudinary
#gem 'cloudinary'
#Paperclip forcloudinary
gem 'paperclip-cloudinary'
#elasticsearch stuff
gem 'elasticsearch-rails'
gem 'elasticsearch-model'
#bonsi
gem 'bonsai-elasticsearch-rails', '~> 0.0.4'



group :development, :test do


end

group :development do
  # 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'
  #db stuff
  gem 'sqlite3'



end
group :production do
  gem 'rails_12factor'
  gem 'puma', '~> 3.4'
  #postgresql
  gem 'pg'
end

我还将包括Heroku拒绝的全部内容,以供参考:

代码语言:javascript
复制
    remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `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.org/..
remote:        Using i18n 0.7.0
remote:        Using rake 11.1.2
remote:        Using json 1.8.3
remote:        Using minitest 5.8.4
remote:        Using thread_safe 0.3.5
remote:        Using builder 3.2.2
remote:        Using erubis 2.7.0
remote:        Using mini_portile2 2.0.0
remote:        Using rack 1.6.4
remote:        Using mime-types-data 3.2016.0221
remote:        Using arel 6.0.3
remote:        Using execjs 2.6.0
remote:        Using aws_cf_signer 0.1.3
remote:        Using bcrypt 3.1.11
remote:        Using bonsai-elasticsearch-rails 0.0.4
remote:        Using sass 3.4.22
remote:        Using will_paginate 3.1.0
remote:        Using coffee-script-source 1.10.0
remote:        Using thor 0.19.1
remote:        Using concurrent-ruby 1.0.1
remote:        Using orm_adapter 0.5.0
remote:        Using multi_json 1.11.2
remote:        Using multipart-post 2.0.0
remote:        Using hashie 3.4.3
remote:        Using elasticsearch-rails 0.1.9
remote:        Using mimemagic 0.3.0
remote:        Using pg 0.18.4
remote:        Using bundler 1.11.2
remote:        Using rails_serve_static_assets 0.0.5
remote:        Using rails_stdout_logging 0.0.5
remote:        Using tilt 2.0.2
remote:        Using rdoc 4.2.2
remote:        Using tzinfo 1.2.2
remote:        Using nokogiri 1.6.7.2
remote:        Using mime-types 3.0
remote:        Using autoprefixer-rails 6.3.6
remote:        Using uglifier 3.0.0
remote:        Using rack-test 0.6.3
remote:        Using warden 1.2.6
remote:        Using bootstrap-will_paginate 0.0.10
remote:        Using coffee-script 2.4.1
remote:        Using sprockets 3.6.0
remote:        Using elasticsearch-api 1.0.17
remote:        Using faraday 0.9.2
remote:        Using rails_12factor 0.0.3
remote:        Using sdoc 0.4.1
remote:        Using activesupport 4.2.5.1
remote:        Using loofah 2.0.3
remote:        Using mail 2.6.4
remote:        Using rest-client 1.6.7
remote:        Using bootstrap-sass 3.3.6
remote:        Using elasticsearch-transport 1.0.17
remote:        Using rails-deprecated_sanitizer 1.0.3
remote:        Using globalid 0.3.6
remote:        Using activemodel 4.2.5.1
remote:        Using climate_control 0.0.3
remote:        Using jbuilder 2.4.1
remote:        Using rails-html-sanitizer 1.0.3
remote:        Using cloudinary 1.2.0
remote:        Using rails-dom-testing 1.0.7
remote:        Using elasticsearch 1.0.17
remote:        Using activejob 4.2.5.1
remote:        Using cocaine 0.5.8
remote:        Using paperclip-cloudinary 1.1.0
remote:        Using actionview 4.2.5.1
remote:        Using elasticsearch-model 0.1.9
remote:        Using activerecord 4.2.5.1
remote:        Using searchkick 1.2.1
remote:        Using paperclip 4.3.6
remote:        Using actionpack 4.2.5.1
remote:        Using actionmailer 4.2.5.1
remote:        Using railties 4.2.5.1
remote:        Using sprockets-rails 3.0.4
remote:        Using coffee-rails 4.1.1
remote:        Using responders 2.1.2
remote:        Using jquery-rails 4.1.1
remote:        Using rails 4.2.5.1
remote:        Using sass-rails 5.0.4
remote:        Using turbolinks 2.5.3
remote:        Using devise 4.0.0
remote:        Installing sqlite3 1.3.11 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160801-197-lz2bsz.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'port install sqlite3 +universal',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-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, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
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_650c9daea9707f0830f7e2ecbfc558e2/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
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:        extconf failed, exit code 1
remote:        Gem files will remain installed in /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:        Bundler Output: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `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.org/..
remote:        Using i18n 0.7.0
remote:        Using rake 11.1.2
remote:        Using json 1.8.3
remote:        Using minitest 5.8.4
remote:        Using thread_safe 0.3.5
remote:        Using builder 3.2.2
remote:        Using erubis 2.7.0
remote:        Using mini_portile2 2.0.0
remote:        Using rack 1.6.4
remote:        Using mime-types-data 3.2016.0221
remote:        Using arel 6.0.3
remote:        Using execjs 2.6.0
remote:        Using aws_cf_signer 0.1.3
remote:        Using bcrypt 3.1.11
remote:        Using bonsai-elasticsearch-rails 0.0.4
remote:        Using sass 3.4.22
remote:        Using will_paginate 3.1.0
remote:        Using coffee-script-source 1.10.0
remote:        Using thor 0.19.1
remote:        Using concurrent-ruby 1.0.1
remote:        Using orm_adapter 0.5.0
remote:        Using multi_json 1.11.2
remote:        Using multipart-post 2.0.0
remote:        Using hashie 3.4.3
remote:        Using elasticsearch-rails 0.1.9
remote:        Using mimemagic 0.3.0
remote:        Using pg 0.18.4
remote:        Using bundler 1.11.2
remote:        Using rails_serve_static_assets 0.0.5
remote:        Using rails_stdout_logging 0.0.5
remote:        Using tilt 2.0.2
remote:        Using rdoc 4.2.2
remote:        Using tzinfo 1.2.2
remote:        Using nokogiri 1.6.7.2
remote:        Using mime-types 3.0
remote:        Using autoprefixer-rails 6.3.6
remote:        Using uglifier 3.0.0
remote:        Using rack-test 0.6.3
remote:        Using warden 1.2.6
remote:        Using bootstrap-will_paginate 0.0.10
remote:        Using coffee-script 2.4.1
remote:        Using sprockets 3.6.0
remote:        Using elasticsearch-api 1.0.17
remote:        Using faraday 0.9.2
remote:        Using rails_12factor 0.0.3
remote:        Using sdoc 0.4.1
remote:        Using activesupport 4.2.5.1
remote:        Using loofah 2.0.3
remote:        Using mail 2.6.4
remote:        Using rest-client 1.6.7
remote:        Using bootstrap-sass 3.3.6
remote:        Using elasticsearch-transport 1.0.17
remote:        Using rails-deprecated_sanitizer 1.0.3
remote:        Using globalid 0.3.6
remote:        Using activemodel 4.2.5.1
remote:        Using climate_control 0.0.3
remote:        Using jbuilder 2.4.1
remote:        Using rails-html-sanitizer 1.0.3
remote:        Using cloudinary 1.2.0
remote:        Using rails-dom-testing 1.0.7
remote:        Using elasticsearch 1.0.17
remote:        Using activejob 4.2.5.1
remote:        Using cocaine 0.5.8
remote:        Using paperclip-cloudinary 1.1.0
remote:        Using actionview 4.2.5.1
remote:        Using elasticsearch-model 0.1.9
remote:        Using activerecord 4.2.5.1
remote:        Using searchkick 1.2.1
remote:        Using paperclip 4.3.6
remote:        Using actionpack 4.2.5.1
remote:        Using actionmailer 4.2.5.1
remote:        Using railties 4.2.5.1
remote:        Using sprockets-rails 3.0.4
remote:        Using coffee-rails 4.1.1
remote:        Using responders 2.1.2
remote:        Using jquery-rails 4.1.1
remote:        Using rails 4.2.5.1
remote:        Using sass-rails 5.0.4
remote:        Using turbolinks 2.5.3
remote:        Using devise 4.0.0
remote:        Installing sqlite3 1.3.11 with native extensions
remote:        
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160801-197-lz2bsz.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'port install sqlite3 +universal',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-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, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for 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_650c9daea9707f0830f7e2ecbfc558e2/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
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:        extconf failed, exit code 1
remote:        
remote:        Gem files will remain installed in /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_650c9daea9707f0830f7e2ecbfc558e2/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
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 professor-ratings.
remote: 

问题可能出在构建配置上吗?我怎样才能改变这一点呢?

EN

回答 5

Stack Overflow用户

发布于 2016-08-01 21:03:38

在开发中使用SQLITE3是很好的,Heroku在生产中只需要PG,你的gemfile应该是这样的:

代码语言:javascript
复制
group :development, :test do
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end

您可能需要重置您的数据库(rails db:reset / rake : reset取决于rails版本)。然后,您可以只运行bundle install --无需生产环境

票数 4
EN

Stack Overflow用户

发布于 2017-02-02 08:57:43

我也有同样的问题,我实现了固定的

gem

  • 删除文件"gemfile.lock"

  • Move "gem 'sqlite3'“到开发组。

  • 添加带有gem‘pg’的生产组:

group :production do gem 'pg‘end

  • 然后捆绑

  • git add .

  • 在控制台或命令提示符或命令行中运行:

heroku配置:设置BUNDLE_WITHOUT="development:test"

  • Dont忘记提交。

  • ,然后,git推送heroku主

GO成功!!

票数 1
EN

Stack Overflow用户

发布于 2016-08-01 21:08:03

代码语言:javascript
复制
remote:  !     Detected sqlite3 gem which is not supported on Heroku.
remote:  !     https://devcenter.heroku.com/articles/sqlite3

默认情况下,Heroku不支持Log it self say的sqlite3。默认情况下,Heroku使用postgres数据库。

确保您的Gemfileproduction group中包含gem 'pg',然后再试一次,它肯定会工作。

如果要在developmet上使用sqlite3,则必须在Gemfile中执行如下代码

代码语言:javascript
复制
#Gemfile
gem 'sqlite3', group: [:development, :test]
gem 'pg', group: :production
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38699353

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档