github 页的捆绑包更新失败

bundle update failing for github-pages

我正在尝试 运行 bundle update 按照 https://help.github.com/articles/using-jekyll-with-pages/ 中的说明更新我 Mac 上的 github 页 gem OS X 10.11.1。我收到此错误...

pschloss@polypay schlosslab.github.io (master) $ bundle update
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using RedCloth 4.2.9
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using addressable 2.3.8
Using blankslate 2.1.2.4
Using fast-stemmer 1.0.2
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using colorator 0.1
Using ffi 1.9.10
Using multipart-post 2.0.0
Using gemoji 2.1.0
Using net-dns 0.8.0
Using public_suffix 1.5.3
Using jekyll-paginate 1.1.0
Using sass 3.4.21
Using rb-fsevent 0.9.7
Using kramdown 1.9.0
Using liquid 2.6.2
Using mercenary 0.3.5
Using posix-spawn 0.3.11
Using yajl-ruby 1.2.1
Using redcarpet 3.3.3
Using safe_yaml 1.0.4
Using jekyll-feed 0.3.1
Using mini_portile2 2.0.0
Using jekyll-sitemap 0.9.0
Using maruku 0.7.0
Using rdiscount 2.1.8
Using terminal-table 1.5.2
Using bundler 1.11.2
Using tzinfo 1.2.2
Using parslet 1.5.0
Using classifier-reborn 2.0.4
Using coffee-script 2.4.1
Using ethon 0.8.1
Using rb-inotify 0.9.5
Using faraday 0.9.2
Using jekyll-sass-converter 1.3.0
Using pygments.rb 0.6.3
Installing nokogiri 1.6.7.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/pschloss/Documents/websites/schlosslab.github.io/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.7.2/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160201-14595-1a3dixy.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... no
-----
libiconv is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/pschloss/Documents/websites/schlosslab.github.io/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/pschloss/Documents/websites/schlosslab.github.io/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Users/pschloss/Documents/websites/schlosslab.github.io/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-15/2.0.0/nokogiri-1.6.7.2/gem_make.out
Using activesupport 4.2.5.1
Using toml 0.1.2
Using jekyll-coffeescript 1.0.1
Using typhoeus 0.8.0
Using listen 3.0.5
Using sawyer 0.6.0
An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.

正如它所建议的那样,我然后 运行 gem install nokogiri -v '1.6.7.2' 并且安装正常。我重复 bundle update 并得到与以前相同的错误。当我执行 nokogiri --version 时,它返回 1.6.7.2:

$ nokogiri --version
# Nokogiri (1.6.7.2)
    ---
    warnings: []
    nokogiri: 1.6.7.2
    ruby:
      version: 2.3.0
      platform: x86_64-darwin15
      description: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
      engine: ruby
    libxml:
      binding: extension
      source: packaged
      libxml2_path: "/Users/pschloss/.gem/ruby/2.3.0/gems/nokogiri-1.6.7.2/ports/x86_64-apple-darwin15.0.0/libxml2/2.9.2"
      libxslt_path: "/Users/pschloss/.gem/ruby/2.3.0/gems/nokogiri-1.6.7.2/ports/x86_64-apple-darwin15.0.0/libxslt/1.1.28"
      libxml2_patches:
      - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
      - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
      - 0003-Stop-parsing-on-entities-boundaries-errors.patch
      - 0004-Cleanup-conditional-section-error-handling.patch
      - 0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
      - 0006-Another-variation-of-overflow-in-Conditional-section.patch
      - 0007-Fix-an-error-in-previous-Conditional-section-patch.patch
      - 0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch
      - 0009-Updated-config.guess.patch
      - 0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch
      - 0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch
      - 0012-Avoid-processing-entities-after-encoding-conversion-.patch
      - 0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch
      - 0014-CVE-2015-5312-Another-entity-expansion-issue.patch
      - 0015-Add-xmlHaltParser-to-stop-the-parser.patch
      - 0016-Detect-incoherency-on-GROW.patch
      - 0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch
      - 0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch
      - 0019-Do-not-print-error-context-when-there-is-none.patch
      - 0020-xmlStopParser-reset-errNo.patch
      - 0021-Reuse-xmlHaltParser-where-it-makes-sense.patch
      libxslt_patches:
      - 0001-Adding-doc-update-related-to-1.1.28.patch
      - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
      - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
      - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
      - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
      - 0007-Separate-function-for-predicate-matching-in-patterns.patch
      - 0008-Fix-direct-pattern-matching.patch
      - 0009-Fix-certain-patterns-with-predicates.patch
      - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
      - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
      - 0014-Fix-for-bug-436589.patch
      - 0015-Fix-mkdir-for-mingw.patch
      - 0016-Fix-for-type-confusion-in-preprocessing-attributes.patch
      - 0017-Updated-config.guess.patch
      compiled: 2.9.2
      loaded: 2.9.2

有什么建议吗?这看起来不像是 nokogiri 问题,而是 github-pages 或 bundler 问题(当然,我也可能是问题所在!)

您的包试图将 gem 安装到 vendor/bundle 而不是系统 gem,这意味着您可能尝试过 --path vendor/bundle--deployment - 请参阅cat .bundle/config

您可以 gem 通过 运行 bundle install --system

恢复使用系统 gems

试试下面的代码。

gem install nokogiri -- --use-system-libraries

我认为在您解决此问题之前,许多程序员都遇到过同样的问题,如果您在 Whosebug 上提出任何问题,请确保是否有此类问题。反正try this

gem install pg -- --with-pg-config= 'PATH_TO_YOUR_PG_CONFIG'

谢谢

问题是扩展构建过程由于某种原因无法找到 libiconv

周围的每个人似乎都建议为 RubyGems 使用额外的参数,但问题明确指出 gem 本身实际上安装了有问题的 gem。所以这与您的 Bundlerbundle of gems 的配置方式有关。

  • 您可以通过 using bundle config:

    将配置应用到 这个特定的包
    bundle config build.nokogiri --use-system-libraries
    

    这大致告诉 Bundler "whenever you install nokogiri, add --use-system-libraries"。

  • ...然后继续:

    bundle update
    

感谢背后的好人this answer.