2017-03-25 2 views
1

J'essaie d'installer Rails avec RVM en utilisant la dernière version de Ruby mais je cours avec un problème lors de l'installation de Nokogiri.Comment réparer une erreur en essayant d'installer Rails avec RVM

J'ai déjà quelques gemsets RVM qui utilisent Ruby 2.4.0 et je n'ai pas eu de problème. J'ai installé Ruby 2.4.1 avec:

rvm install ruby-2.4.0 

et a créé une nouvelle gemset avec:

rvm use [email protected] --create 

Et puis couru:

gem install rails --pre 

Et je suis arrivé cette erreur:

ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

    current directory: /Users/andres/.rvm/gems/[email protected]/gems/nokogiri-1.7.1/ext/nokogiri 
/Users/andres/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20170325-50295-1sw75cw.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. 
Using mini_portile version 2.1.0 
checking for iconv.h... yes 
checking for gzdopen() in -lz... yes 
checking for iconv using --with-opt-* flags... yes 

Et puis:

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 
    --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/andres/.rvm/rubies/ruby-2.4.1/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 
/Users/andres/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError) 
    from /Users/andres/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir' 
    from /Users/andres/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute' 
    from /Users/andres/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile' 
    from /Users/andres/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook' 
    from extconf.rb:364:in `block (2 levels) in process_recipe' 
    from extconf.rb:257:in `block in chdir_for_build' 
    from extconf.rb:256:in `chdir' 
    from extconf.rb:256:in `chdir_for_build' 
    from extconf.rb:363:in `block in process_recipe' 
    from extconf.rb:262:in `tap' 
    from extconf.rb:262:in `process_recipe' 
    from extconf.rb:547:in `<main>' 

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

    /Users/andres/.rvm/gems/[email protected]/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.7.1/mkmf.log 

extconf failed, exit code 1 

Il semblerait que ce soit un problème avec Nokogiri.

J'ai suivi les suggestions dans "Error installing nokogiri: Failed to build gem native extension & libiconv is missing (OSX)" sans succès.

J'ai mis à jour RVM et exécuté gem update mais cela n'a pas fonctionné. Xcode est également mis à jour.

Est-ce que quelqu'un a rencontré ce problème?

+0

Vous ne pouvez pas installer Ruby 2.4.1 en utilisant 'RVM installer Ruby-2.4.0'. Qu'est-ce que /Users/andres/.rvm/gems/[email protected]/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.7.1/mkmf.log dit que le problème est? Qu'avez-vous fait lorsque vous avez mis à jour Xcode? Avez-vous réinstallé les options de la ligne de commande? –

Répondre

4

Essayez ceci:

gem install nokogiri - --with-xml2-include =/Applications/Xcode.app/Contenu/Développeur/Plateformes/MacOSX.platform/Développeur/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-système-bibliothèques

Il a résolu le problème pour moi ...