2017-11-02 14 views
1

bundle과 함께 설치를 시도했지만 오류가 발생했습니다. I do에는 zlib이 설치되어 있습니다.nokogiri 1.7.0.1을 Ubuntu 16.04.3에 어떻게 설치합니까?

Fetching nokogiri 1.7.0.1 


Your user account isn't allowed to install to the system RubyGems. 
    You can cancel this installation and run: 

     bundle install --path vendor/bundle 

    to install the gems into ./vendor/bundle/, or you can enter your password 
    and install the bundled gems to RubyGems using sudo. 

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

current directory: 
/tmp/bundler20171101-9510-jcrqsknokogiri-1.7.0.1/gems/nokogiri-1.7.0.1/ext/nokogiri 
/usr/bin/ruby2.3 -r ./siteconf20171101-9510-tlx1ob.rb extconf.rb 
checking if the C compiler accepts ... yes 
Building nokogiri using packaged libraries. 
Using mini_portile version 2.1.0 
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=/usr/bin/$(RUBY_BASE_NAME)2.3 
    --help 
    --clean 
    --use-system-libraries 
    --enable-static 
    --disable-static 
    --with-zlib-dir 
    --without-zlib-dir 
    --with-zlib-include 
    --without-zlib-include=${zlib-dir}/include 
    --with-zlib-lib 
    --without-zlib-lib=${zlib-dir}/lib 
    --enable-cross-build 
    --disable-cross-build 

To see why this extension failed to compile, please check the mkmf.log which can 
be found here: 

/tmp/bundler20171101-9510-jcrqsknokogiri-1.7.0.1/extensions/x86_64-linux/2.3.0/nokogiri-1.7.0.1/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in 
/tmp/bundler20171101-9510-jcrqsknokogiri-1.7.0.1/gems/nokogiri-1.7.0.1 for 
inspection. 
Results logged to 
/tmp/bundler20171101-9510-jcrqsknokogiri-1.7.0.1/extensions/x86_64-linux/2.3.0/nokogiri-1.7.0.1/gem_make.out 

An error occurred while installing nokogiri (1.7.0.1), and Bundler 
cannot continue. 
Make sure that `gem install nokogiri -v '1.7.0.1'` succeeds before bundling. 

In Gemfile: 
    nested_form_fields was resolved to 0.8.2, which depends on 
    rails was resolved to 5.0.2, which depends on 
     actioncable was resolved to 5.0.2, which depends on 
     actionpack was resolved to 5.0.2, which depends on 
      actionview was resolved to 5.0.2, which depends on 
      rails-dom-testing was resolved to 2.0.2, which depends on 
       nokogiri 
[email protected]:~/projects/fortuneempire$ apt list zlib* 
Listing... Done 
zlib-gst/xenial 3.2.5-1build2 amd64 
zlib1g/xenial-updates,now 1:1.2.8.dfsg-2ubuntu4.1 amd64 [installed] 
zlib1g-dbg/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 
zlib1g-dev/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 
zlibc/xenial,now 0.9k-4.3 amd64 [installed] 
[email protected]:~/projects/$ 
+1

실행 :'sudo apt-g et zlib1g-dev'를 설치하고'nokogiri'를 다시 설치하십시오. – Cyzanfar

+1

그게 효과가있었습니다. 'zlib1g-dev'를 설치했는데 성공했습니다. 오, 나는 그것이 'l'이라고 생각했다. StackOverflow의 글꼴이 터미널과 다릅니다. 왜 이렇게 많은 zlib 패키지가 있는지 나는 모른다. – Chloe

+1

해피 그게 도움이! 'zlib '을 설치 한 후'nokogiri'를 설치 했습니까? – Cyzanfar

답변

1

그것은 당신의 오류처럼 보인다는 zlib에서 오는 :

ZLIB이없는; 건물 libxml2를 위해 필요한이 문제를 해결 수있는 패키지를 설치하는 것 같아

this 토론에서

는 : 다음

우분투에 대한

sudo apt-get install zlib1g-dev 

그냥 nokogiri를 설치하십시오 :

gem install nokogiri -v '1.7.0.1' 
우분투 용