Tag: nokogiri

目次

関連ページ

参考情報

HTMLの解析

基本

Nokogiri::XML::Elementのメソッド

inner_html

タグの内部(HTML残す)

text

テキスト化した内容

to_html

検索系メソッド

at

at_css

at_xpath

css

search

xpath

トラブルシューティング

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

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

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

macOS High Sierraでエラー

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
Last-modified: 2022-07-07 (木) 15:06:58