Ruby-on-rails Bundler 找不到 gem "nokogiri" 的兼容版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14973082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bundler could not find compatible versions for gem "nokogiri"
提问by Ariel Zehao Zhang
I push a rails app to appfog, but got following error message:
我将 rails 应用程序推送到 appfog,但收到以下错误消息:
/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 updatewill rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.
/var/vcap.local/dea/apps/superb-0-dc92a2e492e46c40c06d2abc3ad59841/app/rubygems ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:129'block in resolve Bundler 找不到 gem "nokogiri" 的兼容版本:(Bundler::Versi nConflict) 在快照中 (Gemfile.lock): nokogiri (1.5.6) 在 Gemfile: capybara (= 1.1.2) ruby 依赖于 nokogiri (>= 1.3.3) 红宝石
运行
bundle update将从头开始重建您的快照,仅使用 Gemfile 中的 gem,这可能会解决冲突。
and my Gemfile:
和我的 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
编辑:添加 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)
回答by Amit Thawait
You can try this,
你可以试试这个
Add in your gemfile
添加到您的 gemfile 中
gem 'nokogiri', '1.3.3'
so that your app uses nokogiri 1.3.3 only instead of the latest version
以便您的应用程序仅使用 nokogiri 1.3.3 而不是最新版本
回答by Артур Бадретдинов
I have ruby 2.1.3 rails 4.0.2 nokogiri 1.6.6.2
我有 ruby 2.1.3 rails 4.0.2 nokogiri 1.6.6.2
this helps me
这对我有帮助
export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
回答by BenJaminSila
Execute this command on your console to update your code:
在您的控制台上执行此命令以更新您的代码:
bundle update
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).
在控制台上发生的各种更新中(我使用的是 mac),您应该看到这样的更新:Using nokogiri 1.6.7.2 (was 1.6.6.2)。

