我没有触及我的Rails应用程序大约一年,我决定尝试启动并运行该应用程序,但因为我认为在我的Gemfile中的某个依赖项而陷入困境。我把它包含在底部。
我的问题是我遇到了错误:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:11:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
An error occurred while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling.
然而,在尝试单独安装Nokogiri时,我发现我能够安装-v 1.6.3.1而不会出错。我知道libxml2,libiconv等已安装在我的计算机中,但不确定版本是否与Nokogiri 1.5.2所期望的相匹配。此外,我尝试使用xcode-select --install
方法,但无济于事。
所以我的问题是:
如何更新我的gemfile以使用我能够安装的Nokogiri 1.6.3.1。当我不知道哪个宝石使用它作为依赖时,是否有办法查看它?
如果不逐一删除每个宝石,有没有办法一起找出/删除Nokogiri?
如果无法做#1或#2,那我怎样才能成功安装Nokogiri 1.5.2?
的Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'compass-rails'
gem 'compass-960-plugin'
gem 'uglifier', '1.2.3'
gem 'chosen-rails'
gem 'bbcoder'
gem 'sanitize'
gem 'devise'
gem 'possessive'
gem 'err_merchant', :git => "git://github.com/iindigo/err_merchant.git"
gem 'impressionist'
#gem 'kaminari'
#gem 'bcrypt-ruby', '3.0.1' to use rails has_secure_passwordv
group :development do
gem 'sqlite3', '1.3.5'
gem 'annotate', '2.5.0'
gem 'rails-erd'
gem 'rack-mini-profiler'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
end
gem 'jquery-rails'
gem 'rails_tokeninput', '1.6.1.rc1'
gem 'selectivizr-rails'
gem 'friendly_id'
gem 'haml'
gem 'browser'
group :test, :development do
gem 'rspec-rails', '2.8.1'
gem 'spork', '0.9.0'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '1.4.0'
end
group :production do
gem 'sqlite3', '1.3.5'
# gem 'therubyracer'
end
答案 0 :(得分:1)
sudo apt-get install ruby-dev libxml2-dev libxslt-dev
然后再次尝试运行bundle install
。
答案 1 :(得分:0)
我发现通过执行命令bundle update "gemnamehere"
,可以在无法更新的情况下获取每个gem的依赖关系列表。
这反过来又让我弄清楚我需要改变哪些宝石才能让Nokogiri更新。