将我的Macbook空气升级到优胜美地后,我无法安装导轨。 有一连串的错误,其中一些我已经能够解决。 目前的错误,我一直在努力工作几天没有成功,看起来像这样

naomi$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/Users/naomi/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150330-94892-1kd8mkt.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.
*** 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/naomi/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
/Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/https.rb:22:in `<top (required)>'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:3:in `<top (required)>'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from extconf.rb:395:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.6.2/gem_make.out

当我尝试安装nokogiri时,我明白了

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

/Users/naomi/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150330-94919-1a0u8fd.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.
*** 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/naomi/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
/Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/https.rb:22:in `<top (required)>'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:3:in `<top (required)>'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /Users/naomi/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from extconf.rb:395:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/naomi/.rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/naomi/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.6.2/gem_make.out

我正在运行OSX 10.10.2, ruby -v给了我

ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]

注意:这可能看似重复,但我认为不是:我一直在调查在SO和其他地方建议的解决方案数天,并且已发布的解决方案尚未解决错误。 使用开发人员工具安装Xcode,因此xcode-select --install给了我

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

非常感谢您的帮助!

#1楼 票数:2 已采纳

我在Nokogiri的网站上找到了一个相关问题(最后一篇文章)。他们用以下方法解决了这个问题:

sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.‌​platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries

#2楼 票数:1

问题

出于某种原因,Apple的Yosemite OSX版本没有libxml2的系统可访问安装。 Nokogiri需要这个才能编译,幸运的是Xcode有一个与之捆绑的libxml2版本 - 我们只需要在安装gem时指定它。 让Nokogiri正确安装非常重要,因为到目前为止,Rails 4.2.1.rc4会自动尝试安装它,你会感到很痛苦。

修复

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2

  ask by rainbowsorbet translate from so

未解决问题?本站智能推荐:

15回复

安装 nokogiri 时出错:无法构建 gem 本机扩展并且缺少 libiconv (OSX)

我尝试克隆这个 repo并运行bundle install 。 捆绑进程失败并抛出此错误: 然后我尝试运行这个: 现在我收到这个错误: 我试图遵循这个答案,但我仍然遇到上述相同的错误。 我还尝试再次卸载并安装我的 brew(基于此答案),但它仍然相同。 另外,我尝试了这个解决方案,但
2回复

在优胜美地上安装Nokogiri [重复]

这个问题在这里已有答案: 在Yosemite Mac OS X 10.10 10答案中 缺少安装nokogiri libiconv的失败 我试图在Yosemite上通过RVM安装Ruby on Rails。 但是,当我尝试运行“捆绑安装”时,一切似乎都有效,我发现
1回复

在Mac OS X(Yosemite)上安装滑轨时遇到问题

我正在尝试在Mac OS X(Yosemite)上安装滑轨。 我收到以下错误: 我确实尝试过更新gem,但是仍然出现错误。 我还安装了自制的 请帮忙! 谢谢
3回复

在OS X Yosemite 10.10.1上安装Rails时遇到问题

我遵循installrails.com上的指南,并被困在安装rails的步骤中。 我试过了: 从apple.com安装Xcode的命令行工具; 升级大多数组件(那是晚上-完全不记得是什么); 尝试了另一本指南(由于信誉不佳,不能过去,大声笑),但在安装步骤“ noko
11回复

如何让Ruby / Homebrew / RVM在Yosemite上运行?

安装Yosemite后,我无法运行brew或ruby。 我在brew更新时收到此错误: 在irb上收到此错误:
2回复

在Yosemite 10.10.3上安装Nokogiri

我有: Mac OS X Yosemite 10.10.3 MacPorts(不是Brew) 系统中的Ruby 2(不是RVM) 我想安装Nokogiri并尝试: 得到了: 我试过了: 得到了: 我试过了: 得到了:
2回复

无法在OS X 10.10 Yosemite上安装RMagic和Nokogiri

不得不安装Yosemite来解决Wi-Fi问题,但现在安装rmagick失败。 我已经尝试了StackOverflow和Github上每个帖子的所有内容,但安装仍然失败。 我正在使用通过rbenv安装的ruby 2.1.1p76 (2014-02-24 revision 45161) [
22回复

在OSX 10.10 Yosemite上安装Nokogiri

我最近升级到10.10优胜美地测试版,但是我在安装Nokogiri时遇到了麻烦。 我正在使用RVM和Ruby 1.9.3。 我也按照这里的步骤尝试按照Nokogiri主页上的说明进行操作。 我通过自制程序安装了libxml2(2.9.1)和libxslt(1.1.28),并尝试使用我的