【问题标题】:nokogiri installation error on MacOS Catalina while bundle install捆绑安装时 MacOS Catalina 上的 nokogiri 安装错误
【发布时间】:2021-10-27 18:37:06
【问题描述】:

我遇到了一个新的 nokogiri 问题,我尝试了所有可以在 Stack Overflow 上在线找到的解决方案。我的 ruby​​ 版本是 3.0.1,rbenv 是 1.1.2,rails 是 6.4.1。当我运行“捆绑安装”时,我收到以下错误,我不知道如何修复它。错误本身很长,所以我发布了整个内容!任何帮助,将不胜感激!谢谢!!

Fetching gem metadata from https://rubygems.org/............
Resolving dependencies....
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using minitest 5.14.4
.
.
.
Fetching nokogiri 1.12.3
Using activerecord 6.1.4.1
Using activejob 6.1.4.1
Using jbuilder 2.11.2
Using spring 2.1.1
Installing nokogiri 1.12.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/zerad/coding
Projects/rubyProjects/environment/testapp/vendor/cache/ruby/3.0.0/gems/nokogiri-1.12.3/ext/nokogiri
/Users/zerad/.rbenv/versions/3.0.1/bin/ruby -I
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0 -r
./siteconf20210827-1071-swdvid.rb extconf.rb --use-system-libraries
--with-xml2-include\=/usr/local/opt/libxml2/include/libxml2
checking for whether -std=c99 is accepted as CFLAGS... yes
checking for whether -Wno-declaration-after-statement is accepted as CFLAGS...
yes
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
checking for whether
-Wno-error=unused-command-line-argument-hard-error-in-future is accepted as
CFLAGS... no
checking for whether
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2 is
accepted as CPPFLAGS... yes
Building nokogiri using system libraries.
checking for gzdopen() in -lz... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
Using mini_portile version 2.6.1
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libgumbo-1.0.0-nokogiri.
Configuration options: --enable-shared --disable-static
Copying gumbo-parser files into
tmp/x86_64-apple-darwin19/ports/libgumbo/1.0.0-nokogiri/gumbo-parser...
Running 'compile' for libgumbo 1.0.0-nokogiri... OK
Activating libgumbo 1.0.0-nokogiri (from
ports/x86_64-apple-darwin19/libgumbo/1.0.0-nokogiri)...
checking for whether -I/Users/zerad/coding
Projects/rubyProjects/environment/testapp/vendor/cache/ruby/3.0.0/gems/nokogiri-1.12.3/ext/nokogiri/ports/x86_64-apple-darwin19/libgumbo/1.0.0-nokogiri/include
is accepted as CPPFLAGS... no
checking for gumbo_parse_with_options() in gumbo.h... no
-----
extconf.rb:276:in `ensure_func'
gumbo_parse_with_options 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=/Users/zerad/.rbenv/versions/3.0.1/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --prevent-strip
    --enable-system-libraries
    --disable-system-libraries
    --use-system-libraries
    --enable-system-libraries
    --disable-system-libraries
    --use-system-libraries
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-z-dir
    --without-z-dir
    --with-z-include
    --without-z-include=${z-dir}/include
    --with-z-lib
    --without-z-lib=${z-dir}/lib
    --with-zlib
    --without-zlib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-xml2lib
    --without-xml2lib
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-xsltlib
    --without-xsltlib
    --with-exslt-dir
    --without-exslt-dir
    --with-exslt-include
    --without-exslt-include=${exslt-dir}/include
    --with-exslt-lib
    --without-exslt-lib=${exslt-dir}/lib
    --with-exsltlib
    --without-exsltlib
    --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/zerad/coding
Projects/rubyProjects/environment/testapp/vendor/cache/ruby/3.0.0/extensions/x86_64-darwin-19/3.0.0/nokogiri-1.12.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/zerad/coding
Projects/rubyProjects/environment/testapp/vendor/cache/ruby/3.0.0/gems/nokogiri-1.12.3
for inspection.
Results logged to /Users/zerad/coding
Projects/rubyProjects/environment/testapp/vendor/cache/ruby/3.0.0/extensions/x86_64-darwin-19/3.0.0/nokogiri-1.12.3/gem_make.out

/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:92:in
`run'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in
`block in build'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/3.0.0/tempfile.rb:317:in
`open'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:158:in
`build_extension'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:192:in
`block in build_extensions'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:189:in
`each'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:189:in
`build_extensions'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/rubygems/installer.rb:837:in
`build_extensions'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:66:in
`build_extensions'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:26:in
`install'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/source/rubygems.rb:192:in
`install'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:54:in
`install'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:59:in
`block in install_with_settings'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/rubygems_integration.rb:556:in
`install_with_build_args'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:59:in
`install_with_settings'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:62:in
`apply_func'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:57:in
`block in process_queue'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in
`loop'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in
`process_queue'
/Users/zerad/.rbenv/versions/3.0.1/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing nokogiri (1.12.3), and Bundler
cannot continue.

In Gemfile:
  rails was resolved to 6.1.4.1, which depends on
    actioncable was resolved to 6.1.4.1, which depends on
      actionpack was resolved to 6.1.4.1, which depends on
        actionview was resolved to 6.1.4.1, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

【问题讨论】:

    标签: ruby-on-rails ruby rubygems nokogiri ruby-on-rails-6


    【解决方案1】:

    尝试重新安装所有内容。

    几个月后,我在使用 Ruby on Rails 后来到了这里。删除 Ruby 并清理所有内容,使用 rbenv 重新安装 rubyrails,并更新 yarn。按照 goRails 上的教程操作并确保没有异常。

    例如,如果您安装了 ruby​​ 3.0.1,但“ruby -v”为您提供了 2.7.2,则存在问题。如果你安装了 rails 6.1.3 但显示的是 6.1.4,那就是另一个问题了。

    【讨论】:

      【解决方案2】:

      我在 1.12.3 版中遇到了同样的错误。升级到版本 1.12.4 修复了它。

      【讨论】:

      • 这并没有解决它,但我很欣赏评论!
      猜你喜欢
      • 2015-05-15
      • 2021-05-29
      • 2013-06-16
      • 1970-01-01
      • 2017-01-08
      • 2014-02-08
      • 2019-11-05
      • 2013-12-21
      • 1970-01-01
      相关资源
      最近更新 更多