簡體   English   中英

Nokogiri的Rails包安裝無法正常工作

[英]Rails bundle install not working error with nokogiri

我開始了一個新的Rails項目,將其放入其中,然后嘗試捆綁安裝

我收到以下錯誤

安裝nokogiri(1.6.7)時發生錯誤,並且Bundler無法繼續。 捆綁之前,請確保gem install nokogiri -v '1.6.7'成功。

我很確定這是A級問題,我嘗試使用Google搜索,但沒有發現任何問題,希望我沒有忽略它

謝謝你的幫助

編輯:如果我嘗試手動安裝nokogiri它給出以下錯誤

Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokiogiri
ERROR:  Could not find a valid gem 'nokiogiri' (>= 0) in any repository
ERROR:  Possible alternatives: nokogiri, nokogirl, niceogiri, onigiri
Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/adamkatz/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151213-2420-12wvig2.rb extconf.rb
checking if the C compiler accepts ... *** 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/adamkatz/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
    from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
    from extconf.rb:80:in `nokogiri_try_compile'
    from extconf.rb:87:in `block in add_cflags'
    from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
    from extconf.rb:86:in `add_cflags'
    from extconf.rb:336:in `'

extconf failed, exit code 1

Gem files will remain installed in /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7 for inspection.
Results logged to /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.7/gem_make.out

您需要安裝OS X開發工具(最后輸出會顯示)。

以下是一些有關安裝xcode的好的說明: 在Mac上安裝Ruby on Rails以進行Ruby on Rails開發(大約一半)

如果可行,這似乎是將您送往目的地的最簡單方法。

如果這樣不起作用,您可能會在這里找到幫助:

  1. http://tosbourn.com/nokogiri-wont-install-check-accepted-xcodes-eula/
  2. SO:在OS X 10.10 Yos上安裝Nokogiri

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM