HEROKU - 无法运行 git push heroku master [重复]
Posted
技术标签:
【中文标题】HEROKU - 无法运行 git push heroku master [重复]【英文标题】:HEROKU - cannot run git push heroku master [duplicate] 【发布时间】:2011-12-19 07:09:29 【问题描述】:我运行命令
heroku create --stack cedar
git push heroku master
但它给了我一个错误:
> Counting objects: 144, done. Delta compression using up to 2 threads.
> Compressing objects: 100% (128/128), done. Writing objects: 100%
> (144/144), 50.16 KiB, done. Total 144 (delta 23), reused 0 (delta 0)
>
> -----> Heroku receiving push
> -----> Ruby/Rails app detected
> -----> Installing dependencies using Bundler version 1.1.rc
> Running: bundle install --without development:test --path vendor/bundle --deployment
> Fetching gem metadata from http://rubygems.org/.......
> Installing rake (0.9.2.2)
> Installing multi_json (1.0.3)
> Installing activesupport (3.1.1)
> Installing builder (3.0.0)
> Installing i18n (0.6.0)
> Installing activemodel (3.1.1)
> Installing erubis (2.7.0)
> Installing rack (1.3.5)
> Installing rack-cache (1.1)
> Installing rack-mount (0.8.3)
> Installing rack-test (0.6.1)
> Installing hike (1.2.1)
> Installing tilt (1.3.3)
> Installing sprockets (2.0.3)
> Installing actionpack (3.1.1)
> Installing mime-types (1.17.2)
> Installing polyglot (0.3.2)
> Installing treetop (1.4.10)
> Installing mail (2.3.0)
> Installing actionmailer (3.1.1)
> Installing arel (2.2.1)
> Installing tzinfo (0.3.30)
> Installing activerecord (3.1.1)
> Installing activeresource (3.1.1)
> Installing coffee-script-source (1.1.2)
> Installing execjs (1.2.9)
> Installing coffee-script (2.2.0)
> Installing rack-ssl (1.3.2)
> Installing json (1.6.1) with native extensions
> Installing rdoc (3.11)
> Installing thor (0.14.6)
> Installing railties (3.1.1)
> Installing coffee-rails (3.1.1)
> Installing jquery-rails (1.0.16)
> Installing pg (0.11.0) with native extensions
> Using bundler (1.1.rc)
> Installing rails (3.1.1)
> Installing sass (3.1.10)
> Installing sass-rails (3.1.4)
> **Installing sqlite3 (1.3.4) with native extensions Unfortunately, a fatal error has occurred. Please report this error to
> the Bundler issue tracker at
> https://github.com/carlhuda/bundler/issues so that we can fix it.
> Thanks!**
> /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native
> extension. (Gem::Installer::ExtensionBuildError)
> /usr/local/bin/ruby extconf.rb
> checking for sqlite3.h... no
> sqlite3.h is missing. Try 'port install sqlite3 +universal'
> or 'yum install sqlite3-devel' 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=/usr/local/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/lib
> --enable-local
> --disable-local
> Gem files will remain installed in /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.4
> for inspection.
> Results logged to /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
> from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
> from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
> from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
> from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:90:in
> `block in install'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:78:in
> `preserve_paths'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:89:in
> `install'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in
> `block in install_gem_from_spec'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:93:in
> `with_build_args'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:72:in
> `install_gem_from_spec'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:56:in
> `block in run'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in
> `run'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:in
> `install'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in
> `install'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in
> `run'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in
> `dispatch'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:in
> `start'
> from /tmp/build_272b7nu18wwh5/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/bin/bundle:13:in
> `<top (required)>'
> from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `load'
> from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `<main>' ! ! Failed to install gems via Bundler. ! ! Heroku push rejected,
> failed to compile Ruby/rails app
>
> To git@heroku.com:falling-ice-5948.git ! [remote rejected] master ->
> master (pre-receive hook declined) error: failed to push some refs to
> 'git@heroku.com:falling-ice-5948.git'
编辑 - 这篇文章真的很有帮助:sqlite3-ruby install error
【问题讨论】:
【参考方案1】:将此添加到您的 Gemfile,
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
然后做一个bundle
然后repush 到heroku。您不能在 Heroku 上使用 sqlite3 - 这是错误的原因。
【讨论】:
谢谢,但我仍然遇到同样的问题。当 config/application.rb 文件为 config.assets..enabled = true 时,我的应用程序不起作用,当我将其更改为 false 时,它可以工作,但不使用我的 .css 文件。我该怎么办 ?当我必须添加我的 css 文件时,可能存在特殊数组? 这也没有解决我的问题。 我的答案是解决原始海报问题中关于 sqlite3 无法安装的错误的解决方案。更多问题应作为新问题提出。【参考方案2】:如果您在从 Gemfile 中删除 sqlite3(或使其仅用于开发)后仍然遇到问题,是因为您没有在 Heroku 眼中重新更新该文件,因为它依赖于 Git。
很简单:
git add Gemfile
git commit -m "Removed sqlite3 from Gemfile"
git push heroku master
在意识到这些更改并没有“接受”更改之前,我为此猛烈抨击了一段时间,因为我实际上并没有将它们提交给 Heroku。
【讨论】:
一旦我删除了依赖项,就必须执行 git add Gemfile.lock ,但这对我有用。谢谢【参考方案3】:在尝试了众多论坛中规定的每个修复程序一天后,这对我有用! 首先,如果您使用的是 Rails 教程书或在线,您需要转到第二个版本(在线 http://ruby.railstutorial.org/ 有一个测试版)。
打开你的编辑器并在你的 Gemfile 中添加以下行:
group :production do
gem 'pg', '0.12.2'
end
group :development do
gem 'sqlite3', '1.3.4'
end
现在您还需要将新编辑的 Gemfile 提交到 Heroku,以便按顺序执行下一步。
git add Gemfile
git commit -m "Put Sqlite3 into development in the Gemfile"
git push heroku master
【讨论】:
【参考方案4】:如果在应用 tibbon 和 animuson 的指令后仍然无法正常工作(发生在我身上),请尝试在 Gemfile 中注释掉“gem 'sqlite3'”行,然后再次添加-提交-推送。
【讨论】:
稍微解释一下...你不想在你的gemfile中有任何“冲突”,即删除或注释掉gemfile顶部的“原始”gem sqlite3
(在最初创建您的应用程序/脚手架时插入)。此gem sqlite3
行与上述答案中的条件语句冲突或覆盖。而且,如果这还不够,您可能会遇到与 gem sqlite3
与 gem 'sqlite3', '1.3.4'
的版本冲突【参考方案5】:
我按照这些说明进行操作,但就我而言,我必须将更新的 Gemfile.lock 文件添加到版本控制中。因此,我使用标志 -a 表示“全部”来添加 Gemfile 文件和 Gemfile.lock 文件。
git commit -am "将Sqlite3放入Gemfile中开发并添加更新后的Gemfile.lock" git push heroku master
【讨论】:
【参考方案6】:您可以使用稍微不同的语法来解决这个问题:
gem 'pg', group: :production
gem 'sqlite3', group: :development
【讨论】:
【参考方案7】:如果你有参考:
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
在您的 Gemfile 中,确保将其注释掉或用上面建议的代码替换它。否则,如果仍然存在,您仍然会遇到相同的错误。
【讨论】:
以上是关于HEROKU - 无法运行 git push heroku master [重复]的主要内容,如果未能解决你的问题,请参考以下文章
运行 git heroku push master 时出现致命错误
Heroku git push heroku master 运行 cd client && npm run build 不停
git push heroku master错误权限被拒绝(公钥)[重复]