错误对于gem安装nokogiri和捆绑安装FOR Middleman应用程序 [英] Error FOR gem install nokogiri AND bundle install FOR Middleman app

查看:295
本文介绍了错误对于gem安装nokogiri和捆绑安装FOR Middleman应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从头开始一个Middleman应用程序。每当我尝试运行服务器时,即 middleman server ,我会得到一个错误(下文),告诉我安装nokogiri时发生错误(1.6.6.2),并且Bundler无法继续。



然而,当我尝试安装nokogiri(1.6.6.2)时,我收到另一个错误(下文),说我错误:安装nokogiri时出错:错误:



然后我尝试 bundle install 我的gemfile,但收到另一个错误。任何人都可以告诉我我可能忽略了什么?



每当我尝试运行我的 middleman server 命令时,这:

  /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in`to_specs':找不到'nokogiri'(> = 1.3.3)在67个宝石中(Gem :: LoadError)
签入'GEM_PATH = / Users / Wilhelm / .gem / ruby​​ / 2.0.0: /Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0',执行`gem env`获取更多信息
从/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1311:in`block in activate_dependencies'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300 :从/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in`activate_dependencies'$ / bibrary/Ruby/Site/2.0.0/rubygems的`each'
/specification.rb:1282:in`activate'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1314:in`block in activate_de从/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in'each
from /Library/Ruby/Site/2.0.0/rubygems/specification。从/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in`activate'
从/Library/Ruby/Site/2.0获得rb:1300:在`activate_dependencies'
。 0 / ruby​​gems / core_ext / kernel_gem.rb:67:在`block in gem'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in`synchronize'$ b $ / from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in`gem'
from / usr / bin / middleman:22:in< main>'

以下是我的Gemfile的内容:

 #如果您没有安装OpenSSL,请更新
#以下行以使用http://而不是
source'https://rubygems.org '

gemmiddleman,〜> 3.4.0

#实时重新加载插件
gemmiddleman-livereload,〜> 3.1.0

#在Windows上更快的文件观察器更新:
gemwdm,〜> 0.1.0::platforms => [:mswin,:mingw]

#Windows不附带时区数据
gemtzinfo-data,平台:[:mswin ,::mingw,:jruby]

这里是我的包的结果安装

 从https://rubygems.org /获取gem元数据..... ........ 
从https://rubygems.org / ...获取版本元数据
从https://rubygems.org/获取依赖关系元数据..
解决依赖...
使用i18n 0.7.0
使用json 1.8.3
使用minitest 5.8.0
使用thread_safe 0.3.5
使用tzinfo 1.2.2
使用activesupport 4.2.4
使用捆绑器1.8.2
使用MIME类型2.6.1
使用mini_portile 0.6.2

Gem :: Ext: :BuildError:错误:无法构建gem本地扩展。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150828-20513-wkpoce。 rb extconf.rb --use-system-libraries
检查C编译器是否a ccepts ... yes
检查C编译器是否接受-Wno-error = unused-command-line-argument-hard-error-in-future ... no
使用系统库构建nokogiri。
libxml2版本2.6.21或更高版本是必需的!
*** 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 = / System / Library / Frameworks / Ruby.framework / Versions / 2.0 / usr / bin / ruby​​
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib -include
--without -zlib-include = $ {zlib-dir} / include
--with-zlib-lib
--without-zlib-lib = $ {zlib-dir} / lib
- with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include = $ {xml2-dir} / include
--with-xml2-lib
--without-xml2-lib = $ {xml2-dir} / lib
--with-libxml-2.0-config
--without-libxml -2.0-config
--with-pkg-config
--without-pkg-config
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include = $ {xslt-dir} / include
--with-xslt-lib
--without-xslt- lib = $ {xslt-dir} / lib
--with-libxslt-config
--without-libxslt-config
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include = $ {exslt-dir} / include
--with-exslt-lib
--without-exslt-lib = $ {exslt-dir} / lib
--with-libexslt-config
--without-libexslt-config

extconf失败,退出代码1

Gem文件将保留安装在/var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2中检查。
记录到/var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make的结果。 out
安装nokogiri(1.6.6.2)时发生错误,并且Bundler不能
继续。
确保`gem install nokogiri -v'1.6.6.2'`捆绑成功。

以下是我的结果 sudo gem install nokogiri -v'1.6 .6.2'

 构建原生扩展。这可能需要一段时间... 
错误:安装nokogiri时出错:
错误:无法构建gem原生扩展。

/Users/Wilhelm/.rbenv/versions/1.9.3-dev/bin/ruby extconf.rb
检查C编译器是否接受... yes
检查if C编译器接受-Wno-error = unused-command-line-argument-hard-error-in-future ... no
使用打包库构建nokogiri。
-----
您的编译环境中缺少/usr/include/iconv.h文件,
这意味着您尚未正确安装Xcode命令行工具。

要安装命令行工具,请尝试在
终端上运行`xcode-select --install`并按照说明操作。如果失败,打开Xcode.app,
从菜单中选择Xcode - Open Developer Tool - More Developer
Tools打开开发者网站,下载OS $ b的安装程序$ b版本并运行它。
-----
*** 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 = / Users / Wilhelm / .rbenv / versions / 1.9.3-dev / bin / ruby​​
- 帮助
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include = $ {zlib-dir} / include
--with-zlib-lib
--without-zlib -lib = $ {zlib-dir} / lib
- 启用交叉编译
- 禁用交叉编译


Gem文件将保持安装在/Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2中进行检查。
记录到/Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out $ b的结果$ b


解决方案

这个命令:

sudo gem install nokogiri - --with-xml2-include = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.10。在



/ sparklemotion / nokogiri / issues / 1231#issuecomment-83835884rel =nofollow>这个github问题,解决了我的问题。老实说,我不完全确定为什么如果任何人可以附加评论,澄清究竟是什么,将不胜感激。


I’m starting a Middleman app from scratch. Whenever I attempt to run the server, i.e. middleman server I get an error (below) that tells me "error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue."

However, when I attempt to install nokogiri (1.6.6.2), I get another error (below) that says me "ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension."

I then attempt to bundle install my gemfile but receive another error. Can anyone tell me what I might be overlooking?

Whenever I attempt to run my middleman server command, I get this:

/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'nokogiri' (>= 1.3.3) among 67 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Wilhelm/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1311:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1314:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `gem'
    from /usr/bin/middleman:22:in `<main>'

Here are the contents of my Gemfile:

# If you do not have OpenSSL installed, update
# the following line to use "http://" instead
source 'https://rubygems.org'

gem "middleman", "~>3.4.0"

# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"

# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]

# Windows does not come with time zone data
gem "tzinfo-data", platforms: [:mswin, :mingw, :jruby]

and here are the results from my bundle install:

Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using bundler 1.8.2
Using mime-types 2.6.1
Using mini_portile 0.6.2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150828-20513-wkpoce.rb extconf.rb --use-system-libraries
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 system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --help
    --clean
    --use-system-libraries
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-exslt-dir
    --without-exslt-dir
    --with-exslt-include
    --without-exslt-include=${exslt-dir}/include
    --with-exslt-lib
    --without-exslt-lib=${exslt-dir}/lib
    --with-libexslt-config
    --without-libexslt-config

extconf failed, exit code 1

Gem files will remain installed in /var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.

and here are the results from my sudo gem install nokogiri -v '1.6.6.2':

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

        /Users/Wilhelm/.rbenv/versions/1.9.3-dev/bin/ruby 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.
-----
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions.  If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
-----
*** 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/Wilhelm/.rbenv/versions/1.9.3-dev/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build


Gem files will remain installed in /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

解决方案

This command:

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

found in this github issue, solved my problem. Honestly, I'm not entirely sure why so if anyone could append a comment, elucidating what exactly is going on it would be much appreciated.

这篇关于错误对于gem安装nokogiri和捆绑安装FOR Middleman应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆