Bundler could not find compatible versions for gem "nokogiri"
Asked Answered
D

3

7

I push a rails app to appfog, but got following error message:

/var/vcap.local/dea/apps/superb-0-dc92a2e492e46c40c06d2abc3ad59841/app/rubygems ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve' Bundler could not find compatible versions for gem "nokogiri": (Bundler::Versi nConflict) In snapshot (Gemfile.lock): nokogiri (1.5.6) In Gemfile: capybara (= 1.1.2) ruby depends on nokogiri (>= 1.3.3) ruby

Running bundle update will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.

and my Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'
gem 'mysql2'
gem 'pg'
gem 'thin'
gem 'sqlite3'

group :development, :test do
  gem 'rspec-rails', '2.11.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
end

How to resolve the problem?

edit: add Gemfile.lock

    GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.12)
      actionpack (= 3.2.12)
      mail (~> 2.4.4)
    actionpack (3.2.12)
      activemodel (= 3.2.12)
      activesupport (= 3.2.12)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.12)
      activesupport (= 3.2.12)
      builder (~> 3.0.0)
    activerecord (3.2.12)
      activemodel (= 3.2.12)
      activesupport (= 3.2.12)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.12)
      activemodel (= 3.2.12)
      activesupport (= 3.2.12)
    activesupport (3.2.12)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    arel (3.0.2)
    builder (3.0.4)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    childprocess (0.3.8)
      ffi (~> 1.0, >= 1.0.11)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.5.0)
    daemons (1.1.9)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (1.0.1-x86-mingw32)
    execjs (1.4.0)
      multi_json (~> 1.0)
    ffi (1.4.0-x86-mingw32)
    hike (1.2.1)
    i18n (0.6.4)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.7)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.21)
    multi_json (1.6.1)
    mysql2 (0.3.11-x86-mingw32)
    nokogiri (1.5.6-x86-mingw32)
    pg (0.14.1-x86-mingw32)
    polyglot (0.3.3)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.12)
      actionmailer (= 3.2.12)
      actionpack (= 3.2.12)
      activerecord (= 3.2.12)
      activeresource (= 3.2.12)
      activesupport (= 3.2.12)
      bundler (~> 1.0)
      railties (= 3.2.12)
    railties (3.2.12)
      actionpack (= 3.2.12)
      activesupport (= 3.2.12)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.0.3)
    rdoc (3.12.2)
      json (~> 1.4)
    rspec (2.11.0)
      rspec-core (~> 2.11.0)
      rspec-expectations (~> 2.11.0)
      rspec-mocks (~> 2.11.0)
    rspec-core (2.11.1)
    rspec-expectations (2.11.3)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.11.3)
    rspec-rails (2.11.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.11.0)
    rubyzip (0.9.9)
    sass (3.2.6)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.30.0)
      childprocess (>= 0.2.5)
      multi_json (~> 1.0)
      rubyzip
      websocket (~> 1.0.4)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.7-x86-mingw32)
    thin (1.5.0)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.17.0)
    tilt (1.3.3)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.35)
    uglifier (1.2.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    websocket (1.0.7)
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  capybara (= 1.1.2)
  coffee-rails (= 3.2.2)
  jquery-rails (= 2.0.2)
  mysql2
  pg
  rails (= 3.2.12)
  rspec-rails (= 2.11.0)
  sass-rails (= 3.2.5)
  sqlite3
  thin
  uglifier (= 1.2.3)
Damico answered 20/2, 2013 at 5:45 Comment(5)
Have you tried bundle update ?Strapper
yes, I tried, but doesn't work.Damico
Can you manually delete gemfile.lock?Gesellschaft
the same error message...Damico
try updating bundler... or post your Gemfile.lockDulce
O
6

You can try this,

Add in your gemfile

gem 'nokogiri', '1.3.3'

so that your app uses nokogiri 1.3.3 only instead of the latest version

Orthicon answered 28/2, 2013 at 9:50 Comment(4)
resolved, after add: gem 'nokogiri', '1.3.3' and gem 'ffi', '1.0.11', but why "bundle update" not update the Gem to the best version?Damico
bundle update doesn't updates the gem to best version, it either updates to the version mentioned in the Gemfile or to the latest version available(if not mentioned in the Gemfile).Orthicon
thanks, maybe they can dev a new option : bundle best-update :)Damico
not strictly true, @AmitThawait, bundle update will resolve a dependency tree and try and install versions that satisfy all the other gems dependencies. sometimes this isn't possible, which seems to be the case here (although i'm not 100% sure why). updating bundler might well help.Latinalatinate
P
3

I have ruby 2.1.3 rails 4.0.2 nokogiri 1.6.6.2

this helps me

export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
Pyrrhotite answered 5/2, 2015 at 8:38 Comment(1)
If your on a MAC, and you just upgraded to Yosemite; There are a ton of things to do: 1) brew install libxml2 libxslt 2) brew link libxml2 libxslt; Then do this.Promise
C
3

Execute this command on your console to update your code:

bundle update

And among the various updates occurring on the console (am using a mac) you should see an update like this : Using nokogiri 1.6.7.2 (was 1.6.6.2).

Challenge answered 11/4, 2016 at 3:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.