Rails 3:libxml2 表示,Nokogiri gem 上的捆绑包安装失败

发布于 2024-11-10 13:00:11 字数 4148 浏览 1 评论 0原文

您好,我正在尝试在我的 Windows 计算机上设置开发环境。我已经通过 cygwin 安装了 ruby​​gems。当我运行捆绑安装时,安装 nokogiri gem 时出现错误。它说我缺少 libxml2。

当我访问 nokogiri 网站时,他们说“gem install nokogiri”应该可以满足 Windows 所需的一切。然而,运行它只会给我带来与捆绑安装相同的错误。

Installing nokogiri (1.4.4) with native extensions /usr/lib/ruby/site_ruby/1.8/r
ubygems/installer.rb:543:in `build_extensions': ERROR: Failed to build gem nativ
e extension. (Gem::Installer::ExtensionBuildError)

        /usr/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.
-----
*** 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
$
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
        --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-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4 fo
r inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4/ext/nokogiri/gem_ma
ke.out
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `build_ext
ensions'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:177:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:10
1:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:279:in `preserve_paths'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:91
:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:58:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:93:in `with_build_args'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:57:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:49:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:8:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/cli.rb:270:i
n `update'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `send'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
invocation.rb:118:in `invoke_task'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor.
rb:246:in `dispatch'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
base.rb:389:in `start'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/bin/bundle:13
        from /usr/bin/bundle:19:in `load'
        from /usr/bin/bundle:19

Hi I'm trying to get a dev environment setup on my windows machine. I've installed rubygems via cygwin. When I run bundle install I get an error on installing the nokogiri gem. It says I'm missing libxml2.

When I go to the nokogiri website they say "gem install nokogiri" should do everything I need for windows. However, running that just gives me the same error as bundle install.

Installing nokogiri (1.4.4) with native extensions /usr/lib/ruby/site_ruby/1.8/r
ubygems/installer.rb:543:in `build_extensions': ERROR: Failed to build gem nativ
e extension. (Gem::Installer::ExtensionBuildError)

        /usr/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.
-----
*** 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
$
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
        --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-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4 fo
r inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4/ext/nokogiri/gem_ma
ke.out
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `each'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `build_ext
ensions'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:177:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:10
1:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:279:in `preserve_paths'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:91
:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:58:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:93:in `with_build_args'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:57:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:49:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:8:in `install'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/cli.rb:270:i
n `update'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `send'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `run'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
invocation.rb:118:in `invoke_task'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor.
rb:246:in `dispatch'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
base.rb:389:in `start'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/bin/bundle:13
        from /usr/bin/bundle:19:in `load'
        from /usr/bin/bundle:19

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

合约呢 2024-11-17 13:00:11

我在 Ubuntu 11.04 上遇到了同样的错误,并通过安装 libxml2-dev 包解决了它。

I got the same error on Ubuntu 11.04 and solved it by installing the libxml2-dev package.

我也只是我 2024-11-17 13:00:11

如果安装 liblxml12-dev 软件包无法解决问题,请尝试安装 libxslt-dev 。它解决了我的问题(http://nokogiri.org/tutorials/installing_nokogiri.html

If installing the liblxml12-dev package it doesn't fix, try installing libxslt-dev too. It solved my problem (http://nokogiri.org/tutorials/installing_nokogiri.html)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文