Ruby on rails Can';因为sqlite3而不能将rails应用程序推送到heroku?
我正试图将我的应用程序推送到heroku,但我无法阻止它安装sqlite3-我相信这就是推它出现问题的原因 我已经阅读并应用了以下SO帖子:Ruby on rails Can';因为sqlite3而不能将rails应用程序推送到heroku?,ruby-on-rails,heroku,sqlite,Ruby On Rails,Heroku,Sqlite,我正试图将我的应用程序推送到heroku,但我无法阻止它安装sqlite3-我相信这就是推它出现问题的原因 我已经阅读并应用了以下SO帖子: 我还确保投入我的工作: git add . git commit -m "sqlite3 problem" git push heroku master 我尝试删除Gemfile.lock并运行bundle和bundle install以及添加、提交并将其推送到heroku,但仍然没有成功 这在我的文件中: group :production
git add .
git commit -m "sqlite3 problem"
git push heroku master
我尝试删除Gemfile.lock并运行bundle
和bundle install
以及添加、提交并将其推送到heroku,但仍然没有成功
这在我的文件中:
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 1.3.13,我相信这就是导致错误的原因,尽管我在生产中没有sqlite3。我也尝试过从Gemfile中完全删除sqlite3,并且只有gempg
,但当我将它推到heroku时,它仍然以某种方式安装sqlite3
如何将应用程序成功推送到heroku
编辑:
这个问题已经解决了(技术上还没有——我仍然无法推送,但是sqlite3错误消失了,这就是这个问题的要点)。这里是我做错的地方:当我看到错误消息时,我正在处理其他本地分支,比如iggy-branch-2。我在这个分支上执行了我的git添加、git提交-m“some message”和git推送heroku master
。当我切换回master
branch和git merge iggy-branch-2
时,在我git push heroku master
之后,它停止了安装sqlite3的尝试。似乎当我推到heroku时,它会在master branch中查找gemfile.lock
(如果我错了,有人会纠正我)
这里的评论和回答让我明白了更新gemfile.lock
的唯一方法实际上就是将其捆绑起来。我想我做了所有正确的事情,所以我决定尝试切换分支
带回家:确保我的主机分支是最新的。看起来Heroku在那里寻找gemfile信息
谢谢大家 这是因为herouku使用您的gemfile.lock来了解要使用的gems和版本,而不是gemfile,您必须:
在本地运行捆绑安装以更新gemfile.lock
提交并将更改推送到git(集线器)
推到heroku
祝你好运
编辑:另外,请确保将gemfile.lock包含到git中,尽管这是显而易见的这是因为herouku使用gemfile.lock来了解要使用的gems和版本,而不是gemfile,您必须:
在本地运行捆绑安装以更新gemfile.lock
提交并将更改推送到git(集线器)
推到heroku
祝你好运
编辑:另外,请确保将gemfile.lock包含到git中,尽管当您执行git push heroku master时,这一点很明显,但它会将您的本地主分支推送到heroku remote的主分支上(无论当前签出的是哪个本地分支)
如果您在另一个分支上工作,比如说'feature/foo',并且您想要部署该分支,那么您需要通过执行git push-feature/foo:master
另一种方式,来自:
git推送原点磁头:主磁头
将当前分支推送到origin
存储库中的远程参考匹配master
。此表单可以方便地推送当前分支,而无需考虑其本地名称
正如您正确猜测的那样,问题在于您正在处理一个分支,但正在部署master。这就是为什么在部署之前合并到主机也解决了问题。当您执行git push heroku master
时,它会将您的本地主机分支推到heroku remote的主机分支上(无论当前签出的是哪个本地分支)
如果您在另一个分支上工作,比如说'feature/foo',并且您想要部署该分支,那么您需要通过执行git push-feature/foo:master
另一种方式,来自:
git推送原点磁头:主磁头
将当前分支推送到origin
存储库中的远程参考匹配master
。此表单可以方便地推送当前分支,而无需考虑其本地名称
正如您正确猜测的那样,问题在于您正在处理一个分支,但正在部署master。这就是为什么在部署之前合并到master也解决了问题。执行“捆绑安装”以更新Gemfile.lock。能否将database.ymldo粘贴到“bundle install”以更新Gemfile.lock。你能粘贴你的数据库吗