&tag(nokogiri);

目次[edit]

関連ページ[edit]

参考情報[edit]

HTMLの解析[edit]

基本[edit]

Nokogiri::XML::Elementのメソッド[edit]

inner_html[edit]

タグの内部(HTML残す)

text[edit]

テキスト化した内容

検索系メソッド[edit]

at[edit]

at_css[edit]

at_xpath[edit]

css[edit]

search[edit]

xpath[edit]

トラブルシューティング[edit]

IMPORTANT! Nokogiri builds and uses a packaged version of libxslt.って何?[edit]

Yosemite環境でインストールできない[edit]

extconf.rb failed ***[edit]

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. }}

macOS High Sierraでエラー[edit]

2018/12/07(金)なぜかこれまで「 NOKOGIRI_USE_SYSTEM_LIBRARIES=1」でビルドできていたRailsプロジェクトがビルドできなくなった。以下のようなエラーメッセージが表示される。

Installing nokogiri 1.8.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/sora/work/myproject/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/Users/sora/.anyenv/envs/rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181207-55660-1avexke.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 system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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.

NOKOGIRI_USE_SYSTEM_LIBRARIESを指定しないか、以下のようにlibxmlのパスを明示すればインストールできた。

gem install nokogiri -- --use-system-libraries --with-xml2-config=/opt/local/bin/xml2-config --with-xslt-config=/opt/local/bin/xslt-config

NOKOGIRI_USE_SYSTEM_LIBRARIESを指定しなければいいのだが原因がわからない。OSは10.13.6のままかわっていないので、Xcodeのせい?


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS