为什么在推向Heroku时出现“错误:未能推送一些文件”? [英] Why do I get “error: failed to push some refs” when pushing to Heroku?

查看:133
本文介绍了为什么在推向Heroku时出现“错误:未能推送一些文件”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的新应用上传到Heroku,但我遇到了一些问题。起初,问题在于SQLite,所以我删除了我的 Gemfile 中的 sqlite 行。另一个问题是,当我在控制台写入命令 git push heroku 时,我看到这个错误:


错误:无法推送一些裁判。


Gemfile

  source'https://rubygems.org'

#Bundle edge Rails改为:gem'rails',github:'rails / rails'
gem'rails', '4.0.0'

group:production do
gem'pg'
gem'rails_12factor'
end

#使用SCSS for样式表
gem'sass-rails','〜> 4.0.0'

#使用Uglifier作为JavaScript资源的压缩器
gem'uglifier','> = 1.3.0'

#使用CoffeeScript for。 js.coffee资产和视图
gem'coffee-rails','〜> 4.0.0'

#请参阅https://github.com/sstephenson/execjs#readme以获得更多支持的运行时
gem'therubyracer',平台:: ruby​​

#使用jquery作为JavaScript库
gem'jquery-rails'

#Turbolinks使Web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
gem'turbolinks'

#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder','〜> 1.2'

group:doc do
#bundle exec rake doc:rails在doc / api下生成API。
gem'sdoc',要求:false
结束

#使用ActiveModel has_secure_password
#gem'bcrypt-ruby','〜> 3.0.0'

#使用独角兽作为应用服务器
#gem'unicorn'

#使用Capistrano进行部署
#gem'capistrano' ,group::development

#使用调试器
#gem'debugger',group:[:development,:test]

终端 $ b

  $ git push heroku master 
初始化仓库,完成。
计数对象:60,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(49/49),完成。
写作对象:100%(60/60),14.24 KiB,完成。
总计60(增量2),重用0(增量0)

-----> Ruby应用检测到
----->编译Ruby / Rails
----->使用Ruby版本:ruby-2.0.0
----->使用1.6.3
安装依赖项运行:bundle install --without development:test --path vendor / bundle --binstubs vendor / bundle / bin -j4 --deployment
从https获取gem元数据:/ /rubygems.org/ .........
从https://rubygems.org/获取额外元数据..
安装minitest 4.7.5
安装i18n 0.6.9
安装rake 10.3.2
安装multi_json 1.10.1
安装thread_safe 0.3.4
安装tzinfo 0.3.39
安装生成器3.1.4
安装mime-types 1.25.1
安装erubis 2.7.0
安装rack 1.5.2
安装polyglot 0.3.5
安装activerecord-deprecated_finders 1.0.3
安装arel 4.0.2
安装coffee-script-source 1.7.0
安装execjs 2.2.0
安装hike 1.2.3
安装thor 0.19.1
使用bundler 1.6 0.3
安装tilt 1.4.1
安装sass 3.2.19
安装json 1.8.1
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem原生扩展。
/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb
检查sqlite3.h ...没有
sqlite3。 h缺失。试试'port install sqlite3 + universal',
'yum install sqlite-devel'或'apt-get install libsqlite3-dev'
并检查您的共享库搜索路径(您的
位置sqlite3共享库位于)。
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。
提供的配置选项:
--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 = / tmp / build_1f9f851d-1743-4e22-b574-756689adf44d / vendor / ruby​​-2.0.0 / 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} /
--enable-local
--disable -local
Gem文件将保持安装在/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9进行检查。
记录到/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
的结果安装activesupport 4.0.0
安装rack-test 0.6.2
安装sqlite3(1.3.9)时发生错误,并且Bundler无法继续。
确保在捆绑之前`gem install sqlite3 -v'1.3.9'`成功。
Bundler输出:从https://rubygems.org / .........
获取gem元数据从https://rubygems.org/获取其他元数据..
安装minitest 4.7.5
安装i18n 0.6.9
安装rake 10.3.2
安装multi_json 1.10.1
安装thread_safe 0.3.4
安装tzinfo 0.3.39
安装生成器3.1.4
安装MIME类型1.25.1
安装erubis 2.7.0
安装机架1.5.2
安装多边形0.3.5
安装activerecord-deprecated_finders 1.0.3
安装arel 4.0.2
安装coffee-script-source 1.7.0
安装execjs 2.2.0
安装hike 1.2.3
安装thor 0.19.1
使用bundler 1.6.3
安装tilt 1.4.1
安装sass 3.2.19
安装json 1.8.1

Gem :: Installer :: ExtensionBuil dError:错误:无法构建gem原生扩展。

/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb
检查sqlite3.h ... no
sqlite3.h缺失。试试'port install sqlite3 + universal',
'yum install sqlite-devel'或'apt-get install libsqlite3-dev'
并检查您的共享库搜索路径(您的
位置sqlite3共享库位于)。
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。

提供的配置选项:
--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 = / tmp / build_1f9f851d-1743-4e22-b574-756689adf44d / vendor / ruby​​-2.0.0 / 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} /
--enable-local
--disable -local


Gem文件将保留安装在/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9中进行检查。
记录到/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
的结果安装activesupport 4.0.0
安装rack-test 0.6.2
安装sqlite3(1.3.9)时发生错误,并且Bundler无法继续。
确保在捆绑之前`gem install sqlite3 -v'1.3.9'`成功。

!无法通过Bundler安装宝石。

!检测到Heroku不支持的sqlite3 gem。
! https://devcenter.heroku.com/articles/sqlite3


!推送被拒绝,未能编译Ruby应用程序

到git@heroku.com:aqueous-crag-7074.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能推送一些文件到'git@heroku.com:aqueous-crag-7074.git'
ark @ ark-Aspire-5750G:〜/ qwerty


解决方案

Heroku似乎认为您仍然拥有SQLite Gemfile,根据这个错误:


Gem :: Installer :: ExtensionBuildError :错误:无法构建gem本机扩展。
/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb
检查sqlite3.h ...没有
sqlite3.h 缺少。尝试'port install sqlite3 + universal',


这可能表示您忘记提交 Gemfile 和 Gemfile.lock 更改为Git:

  git add Gemfile Gemfile.lock 
git commit -m添加Gemfile变更

一旦这些版本化了,你应该能够将更改推送到Heroku:



I want to upload my new app to Heroku, but I'm facing some problems. At first, the problem was SQLite, so I deleted the sqlite line in my Gemfile. Another problem is that when I write in console the command git push heroku, I see this error:

error: failed to push some refs.

Gemfile

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# 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', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

Terminal

$ git push heroku master
Initializing repository, done.
Counting objects: 60, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (60/60), 14.24 KiB, done.
Total 60 (delta 2), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Fetching additional metadata from https://rubygems.org/..
       Installing minitest 4.7.5
       Installing i18n 0.6.9
       Installing rake 10.3.2
       Installing multi_json 1.10.1
       Installing thread_safe 0.3.4
       Installing tzinfo 0.3.39
       Installing builder 3.1.4
       Installing mime-types 1.25.1
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing polyglot 0.3.5
       Installing activerecord-deprecated_finders 1.0.3
       Installing arel 4.0.2
       Installing coffee-script-source 1.7.0
       Installing execjs 2.2.0
       Installing hike 1.2.3
       Installing thor 0.19.1
       Using bundler 1.6.3
       Installing tilt 1.4.1
       Installing sass 3.2.19
       Installing json 1.8.1
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for sqlite3.h... no
       sqlite3.h is missing. Try 'port install sqlite3 +universal',
       'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
       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=/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/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}/
       --enable-local
       --disable-local
       Gem files will remain installed in /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
       Results logged to /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
       Installing activesupport 4.0.0
       Installing rack-test 0.6.2
       An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
       Bundler Output: Fetching gem metadata from https://rubygems.org/.........
       Fetching additional metadata from https://rubygems.org/..
       Installing minitest 4.7.5
       Installing i18n 0.6.9
       Installing rake 10.3.2
       Installing multi_json 1.10.1
       Installing thread_safe 0.3.4
       Installing tzinfo 0.3.39
       Installing builder 3.1.4
       Installing mime-types 1.25.1
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing polyglot 0.3.5
       Installing activerecord-deprecated_finders 1.0.3
       Installing arel 4.0.2
       Installing coffee-script-source 1.7.0
       Installing execjs 2.2.0
       Installing hike 1.2.3
       Installing thor 0.19.1
       Using bundler 1.6.3
       Installing tilt 1.4.1
       Installing sass 3.2.19
       Installing json 1.8.1

       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

       /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for sqlite3.h... no
       sqlite3.h is missing. Try 'port install sqlite3 +universal',
       'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
       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=/tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/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}/
       --enable-local
       --disable-local


       Gem files will remain installed in /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
       Results logged to /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
       Installing activesupport 4.0.0
       Installing rack-test 0.6.2
       An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !     
 !     Detected sqlite3 gem which is not supported on Heroku.
 !     https://devcenter.heroku.com/articles/sqlite3
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:aqueous-crag-7074.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:aqueous-crag-7074.git'
ark@ark-Aspire-5750G:~/qwerty$ 

解决方案

Heroku seems to think you still have SQLite in your Gemfile, according to this error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /tmp/build_1f9f851d-1743-4e22-b574-756689adf44d/vendor/ruby-2.0.0/bin/ruby extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal',

which could be an indication that you forgot to commit your Gemfile and Gemfile.lock changes to Git:

git add Gemfile Gemfile.lock
git commit -m "Add Gemfile changes"

Once those are versioned, you should be able to push the changes to Heroku:

git push heroku <branch>

这篇关于为什么在推向Heroku时出现“错误:未能推送一些文件”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆