簡體   English   中英

安裝 nokogiri (1.10.10) 時出錯,Bundler 無法繼續

[英]An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue

  • 操作系統:Ubuntu 18.04
  • ruby:2.7
  • 導軌:6.*

Gem::Ext::BuildError: 錯誤: 無法構建 gem 原生擴展。

 current directory: /home/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10/ext/nokogiri

/home/.rvm/rubies/ruby-2.7.0/bin/ruby -I /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r./siteconf20210329-30335-1ed7nme。 rb extconf.rb --use-system-libraries 檢查 C 編譯器是否接受... *** extconf.rb 失敗 *** 由於某種原因,可能缺少必要的庫和/或頭文件,無法創建 Makefile。 檢查 mkmf.log 文件以獲取更多詳細信息。 您可能需要配置選項。

提供的配置選項: --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=/home/.rvm/rubies/ruby-2.7.0/bin/$(RUBY_BASE_NAME) --help --clean /home/.rvm/rubies/ruby-2.7.0/lib/ruby /2.7.0/mkmf.rb:471:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in block in try_compile' 來自 /home/.rvm/rubies/ruby-2.7.0/lib /ruby/2.7.0/mkmf.rb:544:in with_werror' from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in try_compile' 來自 extconf .rb:138:in nokogiri_try_compile' from extconf.rb:162:in block in add_cflags' from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:655:in with_cflags' from extconf.rb:161:in add_cflags' 來自 extconf.rb:416:in `'

要查看此擴展無法編譯的原因,請查看 mkmf.log,可在此處找到:

/home/.rvm/gems/ruby-2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/mkmf.log

extconf 失敗,退出代碼 1

Gem 文件將繼續安裝在 /home/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10 以供檢查。 結果記錄到 /home/.rvm/gems/ruby-2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/gem_make.out

安裝 nokogiri (1.10.10) 時出錯,Bundler 無法繼續。 確保gem install nokogiri -v '1.10.10' --source 'https://rubygems.org/'在捆綁之前成功。

首先,檢查您的 mkmf.log 文件以獲取更多詳細信息。

gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'

解決方案:brew unlink gcc

$ bundle install (可以正常工作)

暫無
暫無

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

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