2015-05-24 19 views
11

Bất cứ ai nhìn thấy điều này?nokogiri không nâng cấp

gem update nokogiri 
Updating installed gems 
Updating nokogiri 
Building native extensions. This could take a while... 
ERROR: Error installing nokogiri: 
ERROR: Failed to build gem native extension. 

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150524-28193-cqkmxr.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 packaged libraries. 
checking for gzdopen() in -lz... no 
zlib is missing; necessary for building libxml2 
*** 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.0/usr/bin/ruby 
     --help 
     --clean 
     --use-system-libraries 
     --enable-static 
     --disable-static 

Trả lời

29

Tôi vừa mới có vấn đề này cùng trên Ubuntu 14.04 hộp tươi và nó quay ra có một sự phụ thuộc cho các nguồn zlib (tức zlib.h), do đó bạn cần phải:

Trên Ubuntu hoặc Debian:

sudo apt-get install zlib1g-dev 

On Fedora, CentOS hoặc RHEL:

sudo yum install zlib-devel 

hoặc tìm gói tương đương cho hệ điều hành của bạn.

+0

Nó làm việc một cách hoàn hảo! Tôi đã có một vấn đề khi tôi cài đặt đường ray. Tôi đã cố gắng làm theo những gì bạn nói và tôi đã giải quyết được vấn đề của mình. Cảm ơn bạn –

+0

MacOS/OS X cài đặt công cụ dòng lệnh xcode để có được zlib & zlib-devel 'xcode-select --install' –

3

Bạn cần phải cài đặt các phụ thuộc mất tích, ví dụ .:

sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev 

Sau đó thử lại:

gem install nokogiri 
Các vấn đề liên quan