当运行bundle update时,必须在Mac OS X上手动更新Nokogiri



一段时间前,我做了一个简单的bundle update,让我所有的宝石在我的Ruby on Rails项目上更新。然而,有一次,我得到了一个关于Nokogiri的错误:

Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    /Users/scott/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb 
Building nokogiri using packaged libraries.
-----
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----

我做了一些狩猎,并在Nokogiri网站上找到了处理这个问题的说明。根据说明手动安装libiconv后,如下工作:

gem update nokogiri -- --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

所以之后我可以运行bundle update,一切都很好!令人讨厌的是,每次我运行bundle update时,我都要经历这个过程,因为Nokogiri更新得比较频繁……有没有一种自动处理的方法?我知道野尻是一颗受欢迎的宝石!很多人都遇到过这个问题。

更新:按照@Tim Moore的要求,我的bundle env命令的输出:

scotts-mbp:ucode scott$ bundle env
Bundler 1.6.2
Ruby 2.1.2 (2014-05-08 patchlevel 95) [x86_64-darwin13.0]
Rubygems 2.2.2
rvm 1.25.28 (stable)
GEM_HOME /Users/scott/.rvm/gems/ruby-2.1.2@rails4
GEM_PATH /Users/scott/.rvm/gems/ruby-2.1.2@rails4:/Users/scott/.rvm/gems/ruby-2.1.2@global
rubygems-bundler (1.4.4)
Bundler settings
  build.nokogiri
    Set for the current user (/Users/scott/.bundle/config): ""--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib""

Gemfile
source 'http://rubygems.org'
ruby '2.1.2'
gem 'rails', '~> 4.1'
group :development do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
  gem 'rails_12factor'
end
gem 'sass-rails', '~> 4.0.3'
gem 'coffee-rails'
gem 'uglifier'
gem 'foundation-rails'
gem 'compass-rails'
gem 'jquery-rails'
gem 'jquery-rails-cdn'
gem 'turbolinks'
gem 'high_voltage'
gem 'devise'
gem 'cancan'
gem 'rolify'
gem 'liquid'
gem 'paperclip'
gem 'aws-sdk'
gem 'nokogiri'
gem 'jbuilder'
gem 'redcarpet'
gem 'kaminari'
gem 'ruby-saml-idp'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'

Gemfile.lock
GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (4.1.6)
      actionpack (= 4.1.6)
      actionview (= 4.1.6)
      mail (~> 2.5, >= 2.5.4)
    actionpack (4.1.6)
      actionview (= 4.1.6)
      activesupport (= 4.1.6)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.6)
      activesupport (= 4.1.6)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.6)
      activesupport (= 4.1.6)
      builder (~> 3.1)
    activerecord (4.1.6)
      activemodel (= 4.1.6)
      activesupport (= 4.1.6)
      arel (~> 5.0.0)
    activesupport (4.1.6)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arel (5.0.1.20140414130214)
    aws-sdk (1.53.0)
      aws-sdk-v1 (= 1.53.0)
    aws-sdk-v1 (1.53.0)
      json (~> 1.4)
      nokogiri (>= 1.4.4)
    bcrypt (3.1.7)
    builder (3.2.2)
    cancan (1.6.10)
    chunky_png (1.3.1)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.4)
      climate_control (>= 0.0.3, < 1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.8.0)
    compass (0.12.7)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.2.19)
    compass-rails (2.0.0)
      compass (>= 0.12.2)
    devise (3.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    erubis (2.7.0)
    execjs (2.2.1)
    foundation-rails (5.4.4.0)
      railties (>= 3.1.0)
      sass (>= 3.2.0)
    fssm (0.2.10)
    high_voltage (2.2.1)
    hike (1.2.3)
    i18n (0.6.11)
    jbuilder (2.1.3)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-rails-cdn (1.0.3)
      jquery-rails
    json (1.8.1)
    kaminari (0.16.1)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    liquid (2.6.1)
    macaddr (1.7.1)
      systemu (~> 2.6.2)
    mail (2.6.1)
      mime-types (>= 1.16, < 3)
    mime-types (2.3)
    mini_portile (0.6.0)
    minitest (5.4.1)
    multi_json (1.10.1)
    nokogiri (1.6.3.1)
      mini_portile (= 0.6.0)
    orm_adapter (0.5.0)
    paperclip (4.2.0)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types
    pg (0.17.1)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.6)
      actionmailer (= 4.1.6)
      actionpack (= 4.1.6)
      actionview (= 4.1.6)
      activemodel (= 4.1.6)
      activerecord (= 4.1.6)
      activesupport (= 4.1.6)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.6)
      sprockets-rails (~> 2.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.2)
    rails_stdout_logging (0.0.3)
    railties (4.1.6)
      actionpack (= 4.1.6)
      activesupport (= 4.1.6)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    redcarpet (3.1.2)
    rolify (3.4.1)
    ruby-saml-idp (0.3.2)
      uuid
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.4)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.9)
    systemu (2.6.4)
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    turbolinks (2.3.0)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.5.3)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    uuid (2.3.7)
      macaddr (~> 1.0)
    warden (1.2.3)
      rack (>= 1.0)
PLATFORMS
  ruby
DEPENDENCIES
  aws-sdk
  cancan
  coffee-rails
  compass-rails
  devise
  foundation-rails
  high_voltage
  jbuilder
  jquery-rails
  jquery-rails-cdn
  kaminari
  liquid
  nokogiri
  paperclip
  pg
  rails (~> 4.1)
  rails_12factor
  redcarpet
  rolify
  ruby-saml-idp
  sass-rails (~> 4.0.3)
  sqlite3
  turbolinks
  uglifier

您可以将构建设置存储在您的Bundler配置中:

bundle config build.nokogiri --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

看到http://bundler.io/v1.6/man/bundle-config.1.html编译选项

相关内容

  • 没有找到相关文章

最新更新