2015-11-30 6 views
33

Ich versuche, this repo zu klonen und bundle install auszuführen. Das Bundle Prozess fehlgeschlagen ist und diesen Fehler werfen:Fehler beim Installieren von nokogiri: Fehler beim Erstellen der gem nativen Erweiterung & libiconv fehlt (OSX)

... 
    Installing nokogiri 1.6.2.1 with native extensions 
    Building nokogiri using packaged libraries. 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     /Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43880-pntnc6.rb extconf.rb 
    Building nokogiri using packaged libraries. 
    ----- 
    libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. 
    ----- 
    *** 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=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME) 
     --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 

    extconf failed, exit code 1 

    Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection. 
    Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out 
    An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue. 
    Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling. 

Dann versuche ich, dies auszuführen:

gem install nokogiri -v '1.6.2.1' 

Und jetzt bekomme ich diesen Fehler:

Building native extensions. This could take a while... 
Building nokogiri using packaged libraries. 
ERROR: Error installing nokogiri: 
    ERROR: Failed to build gem native extension. 

    /Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43942-1axq4sj.rb extconf.rb 
Building nokogiri using packaged libraries. 
----- 
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. 
----- 
*** 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=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME) 
    --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 

extconf failed, exit code 1 

Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection. 
Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out 

Ich versuchte this answer zu folgen, aber Ich bekomme immer noch den gleichen Fehler oben.

Ich versuche auch, mein Gebräu wieder zu deinstallieren und zu installieren (based on this answer) und es ist immer noch gleich.

Auch versuche ich this solution aber immer noch den Fehler.

Was soll ich jetzt tun, um sicherzustellen, dass dieses nokogiri-Juwel erfolgreich installiert wurde?

Hinweis: Ich verwende OSX 10.11.1 El Capitan.

+1

Haben Sie 'xcode' bereits installiert? Was ist die Ausgabe des Befehls 'xcode-select --install'? Haben Sie auch die [nokogiri OSX Installationsanleitung] (http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x)? –

+0

Ja, ich installiere bereits xcode und führe 'xcode-select --install' aus. Die xcode-Entwicklertools wurden erfolgreich installiert. –

+1

Was hat alle dazu gebracht, den Fehler xcode zu kennen? –

Antwort

2

Scheint wie dies wegen Nokogiri 1.6.2.1 spezifischen Problem ist.

Ich füge dies in meinem Gemfile:

gem 'nokogiri', '~> 1.6', '>= 1.6.7' 

Und laufen bundle update nokogiri und dann bundle. Alles funktioniert jetzt gut.

0

Löschen von Nokogiri in Rbenv Gem Ordner und Neuinstallation löste es für mich.

12

Ich hatte ein ähnliches Problem mit 1.6.7.2, wenn bundle install in Codeship mit Ruby 2.3 inging.

Was für mich gearbeitet wurde und fügte hinzu:

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

vor

bundle install

+0

Dies ist der beste Weg, um das Problem in einer dauerhaften Lösung zu beheben. gem install nokogiri -v 1.6.6.2 - --use-system-bibliotheken – Brandt

101

Sie folgende Befehle ein:

gem uninstall nokogiri 
xcode-select --install 
gem install nokogiri 

Quelle: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

manchmal Updates Mac Xcode CLI brechen so Neuinstallation das Problem zu beheben: https://github.com/sparklemotion/nokogiri/issues/1445

+0

gut, es hat für mich funktioniert. –

+1

ähnliche Antwort: http://stackoverflow.com/questions/19643153/error-to-install-nokogiri-on-osx-10-9-maverick – zimkies

+0

funktioniert wie ein Traum. Danke! – dokun1

9

Ich habe alles in den anderen Antworten, hatte aber noch eine Sache zu tun:

  1. öffnen Xcode
  2. Klicken Sie auf "Akzeptieren"
  3. Warten Sie ein wenig, in der Nähe Xcode
  4. Rejoice
20

Was für mich gearbeitet (auf macOS Sierra) war eine Kombination aus Sam's answer und die folgenden:

gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries 
+0

das ist der Trick! Danke – AnApprentice

+1

Das funktionierte für mich zu versuchen, nokogiri -v 1.8.0 – margo

+0

zu installieren Ich benutzte das gleiche, um Schienen zu installieren, und es hat funktioniert! Vielen Dank. –

0

Ich hatte das gleiche Problem. Der Grund war veraltet xcode.

Wenn Sie brew doctor ausführen, können Sie es sehen. Öffne einfach AppStore, gehe zu updates Tab und aktualisiere deinen xcode.

Verwandte Themen