bundle installを実行するとnokogiriのlibxml2に関するエラーが発生してしまいます。
Fetching nokogiri 1.8.1 Installing nokogiri 1.8.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/macbookpro/Documents/Ruby/members/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180423-89744-d6nawv.rb extconf.rb --use-system-libraries --with-iconv-dir=/usr/local/opt/libiconv 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. 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME) --help --clean --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-xml2-dir --without-xml2-dir --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-libxml-2.0-config --without-libxml-2.0-config --with-pkg-config --without-pkg-config --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-exslt-dir --without-exslt-dir --with-exslt-include --without-exslt-include=${exslt-dir}/include --with-exslt-lib --without-exslt-lib=${exslt-dir}/lib --with-libexslt-config --without-libexslt-config To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/macbookpro/Documents/Ruby/members/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/macbookpro/Documents/Ruby/members/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.8.1 for inspection. Results logged to /Users/macbookpro/Documents/Ruby/members/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.1/gem_make.out An error occurred while installing nokogiri (1.8.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling. In Gemfile: rails was resolved to 5.0.6, which depends on actioncable was resolved to 5.0.6, which depends on actionpack was resolved to 5.0.6, which depends on actionview was resolved to 5.0.6, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri
以下のQiitaを参考にすると
Qiita - OSX への nokogiri 1.6.8.rc3 の install でハマって解決したメモ
libxml2のリンクがされてないことが原因のようですが、実際に見てみると
$ ls -la /usr/local/lib/ | grep libxml2 lrwxr-xr-x 1 macbookpro admin 43 4 22 02:46 libxml2.2.dylib -> ../Cellar/libxml2/2.9.7/lib/libxml2.2.dylib lrwxr-xr-x 1 macbookpro admin 37 4 22 02:46 libxml2.a -> ../Cellar/libxml2/2.9.7/lib/libxml2.a lrwxr-xr-x 1 macbookpro admin 41 4 22 02:46 libxml2.dylib -> ../Cellar/libxml2/2.9.7/lib/libxml2.dylib lrwxr-xr-x 1 macbookpro admin 39 4 22 02:46 xml2Conf.sh -> ../Cellar/libxml2/2.9.7/lib/xml2Conf.sh
すでにリンクがされています。
エラー文を検索しながらサイトに書いてあることを一通りやってみたのですがうまくいかず...
再度bundle install
をやって見ても同じエラーになってしまいます。どうすれば、正常に行われるでしょうか?
解決策をご教授いただけると助かります。
#行ったこと
$ bundle config build.nokogiri --use-system-libraries You are replacing the current global value of build.nokogiri, which is currently "--use-system-libraries --with-iconv-dir=/usr/local/opt/libiconv"
xcodeのコマンドラインツールのインストール
$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates
リンクし直しても当然、すでにされていると言われる。
「brewにいくつかインストールが必要だ」と書いてあっても、下記の環境の通り、全て揃っている。
環境
macOS High Sierra
gemにはすでに以下がインストール済みです。
nokogiri (1.5.6) pkg-config (1.3.0)
homebrewには
libiconv libxslt pkg-config libxml2
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。