Heroku一直拒绝我的推,但是这个错误:
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,我运行了一个bundle install并确保sqlite3 gem也出了我的Gemfile.lock(它是。) 我还从我的database.yml中删除了对sqlite3的所有引用,并用Postgres替换它们:
#
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:
# 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拒绝仅供参考:
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:
问题可能出在构建配置上吗?我该怎么改变呢?'
答案 0 :(得分:2)
使用SQLITE3在开发中很好,Heroku只需要PG进行生产,你的gemfile看起来应该是这样的:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
您可能需要重置数据库(rails db:reset / rake db:reset,具体取决于rails版本)。然后你可以运行bundle install --without production
答案 1 :(得分:0)
one|two|three\|four\|five
记录它自己说默认情况下Heroku不支持sqlite3。默认情况下,Heroku使用remote: ! Detected sqlite3 gem which is not supported on Heroku.
remote: ! https://devcenter.heroku.com/articles/sqlite3
数据库。
确保postgres
中的Gemfile
包含gem 'pg'
,然后重试,一定会有效。
如果您想在production group
上使用sqlite3
,则必须在developmet
Gemfile
答案 2 :(得分:0)
首先确保添加了以下宝石
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
接下来请确保您运行bundle intsall
现在将您的应用推送到github git push origin master
现在您已准备好将其投入生产git push heroku master
捆绑安装后,您需要确保先将应用程序推送到github(假设您使用的是github)
答案 3 :(得分:0)
正如他们所说,你需要更换宝石,但宝石pg不能在Windows上工作,因为最新版本是错误的。所以你需要做三件事才能正确地推送到heroku。 1-将这两个宝石添加到您的gemfile
group :production do
gem 'pg','~>0.19.0.pre20160409114042'
gem 'rails_12factor'
该组仅在您希望将pg保持在生产模式时才主要运行
bundle install
所以确保一切顺利,再次运行服务器所有的宝石都可以,现在我们进入下一步 2-确保你在右侧heroku,显然你是,但这是你可以做的一个很好的技巧
rake assets:precompile
确保所有资产都已编译并准备就绪,然后执行正常的git过程
git add .
git commit -am"latest or whatever you feel like"
3-最后但并非最不重要的是以正确的方式推向heroku
git push heroku master
你推送到了heroku,但你的数据库没有在heroku上运行
heroku run rails db:migrate
所以现在应该一切顺利。
如果还不行,请告诉我们。 希望有用
答案 4 :(得分:0)
我遇到了同样的问题,我实现了修复
添加生产组whit gem&#39; pg&#39;:
group :production do
gem 'pg'
end
在控制台或命令promt或CMD中运行:
heroku config:设置BUNDLE_WITHOUT =&#34;开发:测试&#34;
GO SUCCESS !!