我正在尝试将我的应用程序推送到heroku,但我无法阻止它安装sqlite3 - 我相信这是导致问题推动它的原因。
我已阅读并应用了以下SO帖子:
我也确保完成我的工作:
onEnter
我尝试删除Gemfile.lock并运行git add .
git commit -m "sqlite3 problem"
git push heroku master
和bundle
并添加,提交并将其推送到heroku,但仍然没有运气。
这是在我的Gemfile中:
bundle install
错误日志:
group :production do
gem 'pg'
end
group :development, :test do
gem 'byebug', platform: :mri
gem 'faker', '~> 1.7', '>= 1.7.3'
gem 'rspec-rails', '~> 3.5'
gem 'factory_girl_rails', '~> 4.8'
gem 'sqlite3'
end
每一次,我都会看到这一行remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 1.13.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
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: Installing i18n 0.8.1
remote: Installing rake 12.0.0
remote: Installing concurrent-ruby 1.0.5
remote: Installing minitest 5.10.1
remote: Installing thread_safe 0.3.6
remote: Installing builder 3.2.3
remote: Installing erubis 2.7.0
remote: Installing mini_portile2 2.1.0
remote: Installing nio4r 2.0.0 with native extensions
remote: Installing rack 2.0.1
remote: Installing websocket-extensions 0.1.2
remote: Installing mime-types-data 3.2016.0521
remote: Installing arel 7.1.4
remote: Installing connection_pool 2.2.1
remote: Installing thor 0.19.4
remote: Installing jwt 1.5.6
remote: Installing method_source 0.8.2
remote: Installing multi_json 1.12.1
remote: Using bundler 1.13.7
remote: Installing puma 3.8.2 with native extensions
remote: Installing redis 3.3.3
remote: Installing sqlite3 1.3.13 with native extensions
remote: Installing tzinfo 1.2.3
remote: Installing nokogiri 1.7.1 with native extensions
remote: Installing rack-test 0.6.3
remote: Installing rack-protection 2.0.0
remote: Installing sprockets 3.7.1
remote: Installing websocket-driver 0.6.5 with native extensions
remote: Installing mime-types 3.1
remote: Installing foreman 0.84.0
remote: Installing twilio-ruby 4.11.1
remote: Installing activesupport 5.0.2
remote: Installing sidekiq 5.0.0
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote: current directory:
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/ruby-2.3.4/bin/ruby -r
remote: ./siteconf20170606-219-133actd.rb extconf.rb
remote: checking for sqlite3.h... no
remote: sqlite3.h is missing. Try 'brew install sqlite3',
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_cb97a281aec933a41e755d6b82c2e524/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote: --with-sqlite3-config
remote: --without-sqlite3-config
remote: --with-pkg-config
remote: --without-pkg-config
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: To see why this extension failed to compile, please check the mkmf.log which can
remote: be found here:
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote: extconf failed, exit code 1
remote: Gem files will remain installed in
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote: for inspection.
remote: Results logged to
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote: An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/...........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Installing i18n 0.8.1
remote: Installing rake 12.0.0
remote: Installing concurrent-ruby 1.0.5
remote: Installing minitest 5.10.1
remote: Installing thread_safe 0.3.6
remote: Installing builder 3.2.3
remote: Installing erubis 2.7.0
remote: Installing mini_portile2 2.1.0
remote: Installing nio4r 2.0.0 with native extensions
remote: Installing rack 2.0.1
remote: Installing websocket-extensions 0.1.2
remote: Installing mime-types-data 3.2016.0521
remote: Installing arel 7.1.4
remote: Installing connection_pool 2.2.1
remote: Installing thor 0.19.4
remote: Installing jwt 1.5.6
remote: Installing method_source 0.8.2
remote: Installing multi_json 1.12.1
remote: Using bundler 1.13.7
remote: Installing puma 3.8.2 with native extensions
remote: Installing redis 3.3.3
remote: Installing sqlite3 1.3.13 with native extensions
remote: Installing tzinfo 1.2.3
remote: Installing nokogiri 1.7.1 with native extensions
remote: Installing rack-test 0.6.3
remote: Installing rack-protection 2.0.0
remote: Installing sprockets 3.7.1
remote: Installing websocket-driver 0.6.5 with native extensions
remote: Installing mime-types 3.1
remote: Installing foreman 0.84.0
remote: Installing twilio-ruby 4.11.1
remote: Installing activesupport 5.0.2
remote: Installing sidekiq 5.0.0
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote: current directory:
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/ruby-2.3.4/bin/ruby -r
remote: ./siteconf20170606-219-133actd.rb extconf.rb
remote: checking for sqlite3.h... no
remote: sqlite3.h is missing. Try 'brew install sqlite3',
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_cb97a281aec933a41e755d6b82c2e524/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote: --with-sqlite3-config
remote: --without-sqlite3-config
remote: --with-pkg-config
remote: --without-pkg-config
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: To see why this extension failed to compile, please check the mkmf.log which can
remote: be found here:
remote:
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote:
remote: extconf failed, exit code 1
remote:
remote: Gem files will remain installed in
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote: for inspection.
remote: Results logged to
remote: /tmp/build_cb97a281aec933a41e755d6b82c2e524/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote:
remote: An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote: !
remote: ! Failed to install gems via Bundler.
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:
,我相信这就是造成错误的原因,即使我没有生产中的sqlite3。我也尝试从Gemfile中完全删除sqlite3并且只有Installing sqlite3 1.3.13 with native extensions
,但是当我将它推送到heroku时它仍然会以某种方式安装sqlite3。
如何将应用程序成功推送到heroku?
修改
问题解决了(好吧,技术上没有 - 我仍然无法推送,但是 sqlite3错误消失了,这就是这个问题的要点)。这就是我做错了:当我看到错误消息时,我正在其他本地分支上工作,让我们说 iggy-branch-2 。我在这个分支上做了gem pg
。当我切换回git add ., git commit -m "some message", and git push heroku master
分支和master
时,在git merge iggy-branch-2
之后,它停止尝试安装sqlite3。看来,当我推送到heroku时,它在主分支中查找git push heroku master
(如果我错了,有人会纠正我。)
这里的评论和回答让我了解到,更新gemfile.lock
的唯一方法就是将其捆绑起来。我认为我做了所有正确的事情,所以我决定尝试转换分支。
带回家:确保我的gemfile.lock
分支是最新的。好像Heroku在那里寻找gemfile信息。
谢谢大家!
答案 0 :(得分:0)
这是因为herouku使用你的gemfile.lock知道要使用的gem和版本而不是gemfile,你必须:
编辑:另外,请确保将你的gemfile.lock包含在git中,尽管那种显而易见的
答案 1 :(得分:0)
执行git push heroku master
时,它将把您的本地 master分支推送到heroku远程服务器的master分支上(无论当前哪个本地分支都已签出)。
如果您正在其他分支上工作,请说“功能/ foo”,并且要部署该分支,则需要通过执行git push feature/foo:master
另一种方法,从git push documentation:
git push origin HEAD:master
将当前分支推送到
master
存储库中与origin
匹配的远程引用中。这种形式可以方便地推送当前分支,而无需考虑其本地名称。
正如您正确猜测的那样,问题在于您正在分支上但正在部署master。这就是为什么在部署之前合并为主节点也可以解决问题的原因。