Nokogiri error when running bundle install

孤街浪徒 提交于 2019-11-30 03:44:35
Edouard

I'm using Mac OSX (El Capitan) and it appears to be related to Xcode Developer Tools. I ran xcode-select --install in my working directory, then reran bundle install command and it all worked fine after that ^^.

Hope this could help someone.

I ran into this error and this is what worked for me:

bundle config build.nokogiri --use-system-libraries
bundle install

The problem was with libxml:

libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.

Turned out I was using the default system Ruby (and thus installing all the gems there in /Library/Ruby/Gems) even though rbenv points to ruby-1.9.3 so that's why Nokogiri was complaining.

Fixed this by adding this to $PATH, so rbenv loads before the system ruby:

export PATH="$HOME/.rbenv/bin:$PATH"

make sure you have the latest version of command line tools. if you're not sure just run xcode-select --install and this will pop up a nice gui to guide you through the installation process. you can alternatively check the mac app store to see if you have an update there waiting for you. the current version is Command Line Developer Tool for OS X 10.10 so you can see if Yosemite hasn't got a problem with that. after getting the update, run sudo bundle install and you can have the latest version of nokogiri. good luck.

Try using an older version of nokogiri, it worked for me

gem 'nokogiri', '1.5.9'

If fellow googler is using linux (ubuntu) then installing deb package zlib1g-dev helped

Aye Mon Chit

The following worked for me:

gem install nokogiri -- --use-system-libraries

Install older version with this command:gem install nokogiri -v 1.5.5

You just need to install Homebrew in your macOS

Run on terminal /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!