简体   繁体   English

无法捆绑安装(nokogiri 1.5.2)旧项目,新计算机

[英]Unable to bundle install (nokogiri 1.5.2) old project, new computer

Having not touched my Rails application for around a year, I decided to try to get the application up and running but am stuck because what I believe to be a dependency somewhere in my Gemfile. 大约一年没有接触过我的Rails应用程序,我决定尝试启动并运行该应用程序,但由于我认为是我的Gemfile中的某个依赖项而陷入困境。 I have included it at the bottom. 我已将其包括在底部。

My issue is that I am running into the error: 我的问题是我遇到了错误:

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.

However upon trying to install Nokogiri separately, I found that I am able to install -v 1.6.3.1 without error. 但是,在尝试单独安装Nokogiri时,我发现我可以无错误地安装-v 1.6.3.1。 I know that libxml2, libiconv, etc., are installed in my computer but am unsure if the versions match with what Nokogiri 1.5.2 is expecting. 我知道我的计算机中安装了libxml2,libiconv等,但是不确定版本是否与Nokogiri 1.5.2预期的版本匹配。 Also, I tried using the xcode-select --install approach but to no avail. 另外,我尝试使用xcode-select --install方法,但无济于事。

So my questions are: 所以我的问题是:

  1. How can I update my gemfile to use Nokogiri 1.6.3.1, which I am able to install. 如何更新我的gemfile以使用可以安装的Nokogiri 1.6.3.1。 When I don't know which gem is using it as a dependecy, is there a way to look that up? 当我不知道哪个宝石正在使用它作为依赖时,有没有办法查找它?

  2. Without removing each gem one by one, is there a way to figure out/remove Nokogiri all together? 如果没有一个一个地删除每个宝石,是否有办法一起找出/删除Nokogiri?

  3. If there is no way to do #1 or #2, then how can I successfully install Nokogiri 1.5.2? 如果无法执行#1或#2,那么如何成功安装Nokogiri 1.5.2?

Gemfile: 的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

sudo apt-get install ruby-dev libxml2-dev libxslt-dev ,然后尝试再次运行bundle install

I figured out that by doing the command bundle update "gemnamehere" it was possible to get a list of the dependencies of each gem in the case of failure to update. 我发现通过执行命令bundle update "gemnamehere" ,可以在更新失败的情况下获得每个gem的依赖项列表。

This in turn allowed me to figure out which gems I needed to change in-order to get Nokogiri to update. 反过来,这使我能够找出需要更改哪些宝石才能更新Nokogiri。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM