2016-06-07 89 views
-1

我工作的Ruby on Rails的,每當我嘗試安裝引入nokogiri-1.6.7.2,我得到以下錯誤:我不能安裝引入nokogiri


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

current directory: /usr/local/opt/gems/gems/nokogiri-1.6.7.2/ext/nokogiri 
/usr/local/bin/ruby -r ./siteconf20160607-19453-7k21kq.rb extconf.rb 
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2 
Ignoring byebug-8.2.2 because its extensions are not built. Try: gem pristine byebug --version 8.2.2 
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2 
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. 
Ignoring nokogiri-1.6.7.2 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7.2 
Ignoring sqlite3-1.3.11 because its extensions are not built. Try: gem pristine sqlite3 --version 1.3.11 
*** 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/local/bin/$(RUBY_BASE_NAME) 
    --help 
    --clean 
    --use-system-libraries 
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- openssl (LoadError) 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/2.3.0/net/https.rb:23:in `<top (required)>' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/gems/2.3.0/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:3:in `<top (required)>' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/gems/2.3.0/gems/mini_portile2-2.0.0/lib/mini_portile2.rb:2:in `<top (required)>' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from extconf.rb:397:in `<main>' 

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

    /usr/local/opt/gems/extensions/x86_64-darwin-15/2.3.0-static/nokogiri-1.6.7.2/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /usr/local/opt/gems/gems/nokogiri-1.6.7.2 for inspection. 
Results logged to /usr/local/opt/gems/extensions/x86_64-darwin-15/2.3.0-static/nokogiri-1.6.7.2/gem_make.out 

由於這Rails的服務器也沒有啓動,並給我的錯誤..請幫助mkmf.log的測試結果如下: -


"clang -o conftest -I/usr/local/include/ruby-2.3.0/x86_64-darwin15 -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe conftest.c -L. -L/usr/local/lib -L. -fstack-protector -L/usr/local/lib  -lruby-static -framework CoreFoundation -lpthread -lgmp -ldl -lobjc " 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv) 
4: { 
5: return 0; 
6: } 
/* end */ 

"clang -I/usr/local/include/ruby-2.3.0/x86_64-darwin15 -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe -Werror -c conftest.c" 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main() {return 0;} 
/* end */ 

"clang -I/usr/local/include/ruby-2.3.0/x86_64-darwin15 -I/usr/local/include/ruby-2.3.0/ruby/backward -I/usr/local/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -Werror -c conftest.c" 
error: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Werror,-Wunknown-warning-option] 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main() {return 0;} 
/* end */ 

任何人都可以請幫我解決這個問題。 謝謝

+0

您必須安裝依賴庫,圍繞網絡搜索,你會得到它 – Bijendra

+0

我已經使用了依賴庫,並使用Rbenv重新安裝紅寶石..你認爲我正在使用任何特定的依賴庫? – Shahsayyad

+0

您正在使用的紅寶石和導軌上的哪個版本。我也希望你使用unix環境來執行這些命令 – Bijendra

回答

0

這個問題實際上與nokogiri無關,更多與rbenv(或具體來說,紅寶石構建)。

9次出10,運行xcode-select --install將解決這個問題。如果沒有,我會建議檢查this wiki article以確保您的編譯環境已正確配置。

如果您在此之後需要更多幫助,我會建議使用rbenv來標記您的問題。就我個人而言,因爲這樣的煩惱,我停止使用它。

+0

我確實運行了xcode-select --install但是沒有幫助..如果你已經停止使用rbenv然後你用什麼? – Shahsayyad

+0

[rvm](http://rvm.io/) – tagCincy

0

嘗試安裝節點:

sudo apt-get install nodejs