0

を使用してnokigiriを正常にインストールできます

sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2  --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib

ただし、「バンドル インストール」を実行すると、libxml2 の問題が発生します。私の質問は、バンドラー経由で nokogiri をインストールするにはどうすればよいですか?

ここに私の「バンドルインストール」出力があります:

Installing nokogiri (1.6.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/philswenson/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2
Extracting libxml2-2.8.0.tar.gz into tmp/i686-apple-darwin11/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/i686-apple-darwin11/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxslt/1.1.26)...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.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
    --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/philswenson/.rvm/rubies/ruby-1.9.3-p448/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=${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
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-libiconv-config
    --without-libiconv-config
    --with-xml2lib
    --without-xml2lib


Gem files will remain installed in /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0 for inspection.
Results logged to /Users/philswenson/.rvm/gems/ruby-1.9.3-p448@3rdrevolution/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out

An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

誰かが私を正しい方向に向けることができますか?

ありがとう!

4

2 に答える 2

1

sudoRVM または同様の Ruby バージョン マネージャーを使用している場合は、使用しないでください。

于 2013-08-28T05:31:31.650 に答える
0

これは、最新の Xcode CLT、マウンテン ライオン、マーベリックス、および nokogiri 1.6.1 で動作します。

中間解 0

まさに nokogiri のパッチを brew formula として libxslt と libxml2

curl -L https://gist.githubusercontent.com/steakknife/8969368/raw/install_nokogiri_brew_osx.sh | bash

シェルへの https パイプを信頼しない場合は、スクリプト raw url を次に示します【要旨URL】

はるかに高速で、libiconv と nokogiri の libxml2 と libxslt の既知の優れた樽のみのコピーを提供します。システム libxml2 は変更されていません。

暫定解決策 1

これには数分かかり、インストール時に 100 MiB+ を消費します。

gem install nokogiri

いずれにせよ、libxml2 をより安定させる必要があるか、それとも事実上のフォークであり、誰にとってもより多くの作業を行う必要があります。

libxml2 や libxslt をリンクしたり、何でも sudo したり、libiconv をインストールしたりしないでください。これらは不要で壊れやすいものです。

于 2014-02-13T03:08:11.630 に答える