安装rails出错(未能构建本机gem的扩展2019-03-19)
在执行gem install rails -v 5.0.0时出错:
bogon:~ jinzesu$ gem install rails -v 5.0.0
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/jinzesu/.rvm/gems/ruby-2.3.1/gems/nokogiri-1.10.1/ext/nokogiri
1
/Users/jinzesu/.rvm/rubies/ruby-2.3.1/bin/ruby -I /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0 -r ./siteconf20190302-2602-fo4900.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2… yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future… no
Building nokogiri using packaged libraries.
*** 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
–with-opt-include
–without-opt-include=opt?dir/include??with?opt?lib??without?opt?lib=
opt?dir/include??with?opt?lib??without?opt?lib={opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/Users/jinzesu/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
–help
–clean
–use-system-libraries
/Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- openssl (LoadError) from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:inrequire’
from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/https.rb:23:in
from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:3:in
from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:inrequire’
from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.4.0/lib/mini_portile2.rb:2:in
from /Users/jinzesu/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in require' from extconf.rb:470:in’
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/jinzesu/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/nokogiri-1.10.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/jinzesu/.rvm/gems/ruby-2.3.1/gems/nokogiri-1.10.1 for inspection.
Results logged to /Users/jinzesu/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-18/2.3.0/nokogiri-1.10.1/gem_make.out
解决方法如下:
【安装rails出错(未能构建本机gem的扩展2019-03-19)】gem install nokogiri -- --use-system-libraries
推荐阅读
- Mac安装Chromedriver
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- MAC安装Mongo
- 【Hadoop踩雷】Mac下安装Hadoop3以及Java版本问题
- react|react 安装
- VueX--VUE核心插件
- python-安装sublime遇到异常
- typeScript入门基础介绍
- 【译】Rails|【译】Rails 5.0正式发布(Action Cable,API模式等)
- 监控nginx