Bundler不允许我安装gem包。

3
我试图消除这些烦人的 DEPRECATION WARNINGS,每当我尝试运行 rspec 测试时(我正在完成 Rails 教程)。
我尝试遵循这里的建议:rspec triggers "DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically." 来简单地更新我的 rspec 版本。
然而,每当我尝试那样做,我就会得到这样的消息:
The bundle currently has rspec-core locked at 2.1.0.
Try running `bundle update rspec-core`

或者是这样:
Bundler could not find compatible versions for gem "rspec-core":
  In Gemfile:
    rspec-rails (= 2.1.0) x86-mingw32 depends on
      rspec-core (~> 2.1.0) x86-mingw32

    rspec-core (2.10.1)

最后,我直接运行了bundle install以更新所有的gem包。然而,这却没有更新那些rspec gem包。这是怎么回事?(我一路将我的提交更新到了当前的git分支上。)
谢谢。
编辑:这是我的gemfile和gemfile.lock的样子:
source 'https://rubygems.org'

gem 'rails', '3.2.1'

group :development, :test do
    gem 'sqlite3', '1.3.5'
    gem 'rspec-rails', '2.1.0' #NOTICE: possible error with rails version
end

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

group :production do
  gem 'pg', '0.12.2'
end

我的Gemfile.lock文件内容如下:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.1)
      actionpack (= 3.2.1)
      mail (~> 2.4.0)
    actionpack (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.1)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.1)
      activesupport (= 3.2.1)
      builder (~> 3.0.0)
    activerecord (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
      arel (~> 3.0.0)
      tzinfo (~> 0.3.29)
    activeresource (3.2.1)
      activemodel (= 3.2.1)
      activesupport (= 3.2.1)
    activesupport (3.2.1)
      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.7)
      ffi (~> 1.0, >= 1.0.6)
    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.4.0)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    execjs (1.4.0)
      multi_json (~> 1.0)
    ffi (1.3.1-x86-mingw32)
    hike (1.2.1)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.6)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.20.1)
    multi_json (1.5.0)
    nokogiri (1.5.6-x86-mingw32)
    pg (0.12.2-x86-mingw32)
    polyglot (0.3.3)
    rack (1.4.4)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.1)
      actionmailer (= 3.2.1)
      actionpack (= 3.2.1)
      activerecord (= 3.2.1)
      activeresource (= 3.2.1)
      activesupport (= 3.2.1)
      bundler (~> 1.0)
      railties (= 3.2.1)
    railties (3.2.1)
      actionpack (= 3.2.1)
      activesupport (= 3.2.1)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (10.0.3)
    rdoc (3.12.1)
      json (~> 1.4)
    rspec (2.1.0)
      rspec-core (~> 2.1.0)
      rspec-expectations (~> 2.1.0)
      rspec-mocks (~> 2.1.0)
    rspec-core (2.1.0)
    rspec-expectations (2.1.0)
      diff-lcs (~> 1.1.2)
    rspec-mocks (2.1.0)
    rspec-rails (2.1.0)
      rspec (~> 2.1.0)
    rubyzip (0.9.9)
    sass (3.2.5)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.29.0)
      childprocess (>= 0.2.5)
      multi_json (~> 1.0)
      rubyzip
      websocket (~> 1.0.4)
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.5-x86-mingw32)
    thor (0.14.6)
    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)
  pg (= 0.12.2)
  rails (= 3.2.1)
  rspec-rails (= 2.1.0)
  sass-rails (~> 3.2.5)
  sqlite3 (= 1.3.5)
  uglifier (= 1.2.3)

你尝试过删除 gemfile.lock 文件并重新运行 bundle 命令吗?执行后的输出是什么? - Deej
1个回答

5
我认为您在此遇到的问题是需要简单执行以下步骤。
sudo gem uninstall rspec-core -v 2.2.1
bundle update rspec-core

这可能需要其他依赖 gem(例如 rspec-rails、rspec)。
可以通过执行gem list rspec进行检查。

我曾经遇到过与Sprockets 3.7.0相同的问题。实际上,我通过gem list sprockets; gem uninstall sprockets; Choose the one you want to uninstall卸载了Sprocket 3.7.0。但是我收到了错误消息“bundle当前已锁定sprockets 3.7.0”。但是在@David的建议下,我执行了bundle update sprockets。一切都像魔术般地正常工作了。 - arthur bryant

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接