【问题标题】:Rails Gemes versions and the `Gemfile` compiled have problems?Rails Gemes 版本和编译的 `Gemfile` 有问题吗?
【发布时间】:2017-06-17 05:53:09
【问题描述】:

我有一个非常大的项目在某个测试版本中开发,项目运行良好,但是rspecGemfileGemfile.lock有问题,一些开发人员已经更新了一些gem但是没有删除旧的Gemfile.lock,所以我们对项目没有任何问题,因为Gemfile 没有与项目崩溃。 提交太多之后,我发现了问题,我认为是宝石之间的差异。

当我复制并粘贴 Gemfile.lock 的最新版本时,所有规范都运行良好,但如果我删除旧的 Gemfile.lock 并再次运行 bundle install,项目将出现许多问题规格 我认为是针对 gems 版本的,但我尝试安装与旧 Gemfile.lock 中相同的版本,我遇到了同样的问题,还有一些 gems 找不到原始版本。

项目太大了,我无法更新Gemfile我认为可能的解决方案之一是使用程序将Gemfile.lock 转换为Gemfile 以使我的规格没有任何错误

这是我的旧 Gemfile.lock,它使我的 rspec 运行良好:

GEM
  remote: https://rubygems.org/
  specs:
    aasm (3.0.3)
      activerecord
    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)
    active_median (0.0.1)
    active_record_query_trace (1.5.4)
    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)
    addressable (2.2.7)
    akami (1.0.0)
      gyoku (>= 0.4.0)
    algorithms (0.5.0)
    arel (3.0.2)
    awesome_nested_set (2.1.6)
      activerecord (>= 3.0.0)
    bcrypt-ruby (3.0.1)
    bluepill (0.0.66)
      activesupport (>= 3.0.0, < 4.0.0)
      daemons (~> 1.1.4)
      i18n (>= 0.5.0)
      state_machine (~> 1.1)
    bourne (1.6.0)
      mocha (~> 1.1)
    builder (3.0.0)
    cancan (1.6.7)
    capistrano (2.11.2)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    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.2.0)
    columnize (0.9.0)
    daemons (1.1.9)
    database_cleaner (0.7.2)
    debugger (1.6.8)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.2.0)
      debugger-ruby_core_source (~> 1.3.5)
    debugger-linecache (1.2.0)
    debugger-ruby_core_source (1.3.8)
    devise (2.0.4)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.3)
      railties (~> 3.1)
      warden (~> 1.1.1)
    devise_lastseenable (0.0.6)
      devise
      rails (>= 3.0.4)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    exception_notification (2.6.1)
      actionmailer (>= 3.0.4)
    execjs (1.3.0)
      multi_json (~> 1.0)
    factory_girl (3.0.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (3.0.0)
      factory_girl (~> 3.0.0)
      railties (>= 3.0.0)
    faraday (0.7.6)
      addressable (~> 2.2)
      multipart-post (~> 1.1)
      rack (~> 1.1)
    geocoder (1.1.1)
    groupdate (1.0.4)
      activerecord (>= 3.0.0)
    gyoku (0.4.4)
      builder (>= 2.1.2)
    highline (1.6.11)
    hike (1.2.1)
    holidays (3.3.0)
    httpi (0.9.6)
      rack
    i18n (0.6.0)
    i18n-inflector (2.6.6)
      i18n (>= 0.4.1)
    journey (1.0.3)
    json (1.6.5)
    kaminari (0.13.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
      railties (>= 3.0.0)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    metaclass (0.0.4)
    mime-types (1.18)
    mocha (1.2.1)
      metaclass (~> 0.0.1)
    multi_json (1.1.0)
    multipart-post (1.1.5)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.9.2)
    net-ssh-gateway (1.1.0)
      net-ssh (>= 1.99.1)
    newrelic_rpm (3.15.2.317)
    nokogiri (1.5.2)
    nori (1.1.0)
    oauth (0.4.5)
    oauth-plugin (0.4.0.rc2)
      multi_json
      oauth (~> 0.4.4)
      oauth2
      rack
    oauth2 (0.5.2)
      faraday (~> 0.7)
      multi_json (~> 1.0)
    orm_adapter (0.0.7)
    passenger (5.0.28)
      rack
      rake (>= 0.8.1)
    pg (0.18.4)
    polyglot (0.3.3)
    rabl (0.6.2)
      activesupport (>= 2.3.14)
      multi_json (~> 1.1.0)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-protection (1.2.0)
      rack
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      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 (11.1.2)
    rdoc (3.12)
      json (~> 1.4)
    redis (2.2.2)
    redis-actionpack (3.2.1)
      actionpack (= 3.2.1)
      redis-rack (~> 1.4.0)
      redis-store (~> 1.1.0)
    redis-activesupport (3.2.1)
      activesupport (= 3.2.1)
      redis-store (~> 1.1.0)
    redis-namespace (1.0.3)
      redis (< 3.0.0)
    redis-rack (1.4.1)
      rack (= 1.4.1)
      redis-store (~> 1.1.0)
    redis-rails (3.2.1)
      redis-actionpack (~> 3.2.1)
      redis-activesupport (~> 3.2.1)
      redis-store (~> 1.1.0)
    redis-store (1.1.0)
      redis (~> 2.2.0)
    resque (1.20.0)
      multi_json (~> 1.0)
      redis-namespace (~> 1.0.2)
      sinatra (>= 0.9.2)
      vegas (~> 0.1.2)
    resque-scheduler (2.0.0)
      redis (>= 2.0.1)
      resque (>= 1.20.0)
      rufus-scheduler
    resque_mailer (2.0.3)
      actionmailer (>= 3.0.0)
      resque (>= 1.2.3)
    resque_spec (0.12.2)
      resque (>= 1.19.0)
      rspec (>= 2.5.0)
    rspec (2.9.0)
      rspec-core (~> 2.9.0)
      rspec-expectations (~> 2.9.0)
      rspec-mocks (~> 2.9.0)
    rspec-core (2.9.0)
    rspec-expectations (2.9.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.9.0)
    rspec-rails (2.9.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.9.0)
    rufus-scheduler (2.0.17)
      tzinfo (>= 0.3.23)
    rvm-capistrano (1.0.2)
      capistrano (>= 2.0.0)
    sass (3.1.15)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    savon (0.9.9)
      akami (~> 1.0)
      builder (>= 2.1.2)
      gyoku (>= 0.4.0)
      httpi (~> 0.9)
      nokogiri (>= 1.4.0)
      nori (~> 1.1)
      wasabi (~> 2.1)
    shoulda-matchers (1.5.6)
      activesupport (>= 3.0.0)
      bourne (~> 1.3)
    simplecov (0.6.1)
      multi_json (~> 1.0)
      simplecov-html (~> 0.5.3)
    simplecov-html (0.5.3)
    sinatra (1.3.2)
      rack (~> 1.3, >= 1.3.6)
      rack-protection (~> 1.2)
      tilt (~> 1.3, >= 1.3.3)
    slack-notifier (1.5.1)
    sprockets (2.1.2)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.5)
    state_machine (1.2.0)
    strip_attributes (1.1.0)
      activemodel (~> 3.0)
    sugarcrm (0.9.18)
      activesupport (>= 2.3.10)
      i18n
      json
    thor (0.14.6)
    tilt (1.3.3)
    timecop (0.8.1)
    timezone (0.99.2)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    typhoeus (0.3.3)
      mime-types
    tzinfo (0.3.49)
    uglifier (1.2.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    vegas (0.1.11)
      rack (>= 1.0.0)
    warden (1.1.1)
      rack (>= 1.0)
    wasabi (2.1.0)
      nokogiri (>= 1.4.0)

PLATFORMS
  ruby

DEPENDENCIES
  aasm
  active_median
  active_record_query_trace
  algorithms
  awesome_nested_set
  bluepill
  cancan
  capistrano
  coffee-rails (~> 3.2.1)
  database_cleaner (~> 0.7.1)
  debugger
  devise
  devise_lastseenable
  exception_notification (~> 2.6.1)
  factory_girl_rails
  geocoder
  groupdate
  holidays
  i18n-inflector
  kaminari
  net-ssh (= 2.9.2)
  newrelic_rpm
  nokogiri
  oauth-plugin (>= 0.4.0.pre1)
  passenger
  pg
  rabl (~> 0.6.0)
  rails (= 3.2.1)
  redis-rails
  resque (~> 1.20.0)
  resque-scheduler
  resque_mailer (~> 2.0.3)
  resque_spec
  rspec-rails (~> 2.4)
  rvm-capistrano
  sass-rails (~> 3.2.3)
  savon (~> 0.9.9)
  shoulda-matchers (~> 1.5.0)
  simplecov
  slack-notifier (~> 1.5, >= 1.5.1)
  sqlite3
  strip_attributes (~> 1.0)
  sugarcrm
  timecop
  timezone
  typhoeus (~> 0.3.3)
  tzinfo (~> 0.3.49)
  uglifier (>= 1.0.3)

BUNDLED WITH
   1.14.6

这是我将Gemfile.lock复制到Gemfile的尝试:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

gem 'pg', '~> 0.18.4', group: [:development, :test, :production]

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

group :production do
  gem 'passenger', '~> 5.0.8'
  # gem 'passenger', '~> 5.1.4'
end

gem 'devise'
gem 'devise_lastseenable'
gem 'cancan'
gem 'oauth-plugin', ">= 0.4.0.pre1"

group :test, :development, :vcr do
  gem 'rspec', '~> 1.1.3'
  gem "rspec-rails", "~> 2.99"
  gem 'factory_girl_rails'
  gem 'timecop'
  gem 'shoulda-matchers', '~> 2.8.0'#, git: 'git://github.com/thoughtbot/shoulda-matchers.git'
  gem 'debugger'
  gem 'sqlite3'
  gem 'database_cleaner', '~> 0.7.1'
  gem 'simplecov'
end

group :test do
  gem 'resque_spec'
end

gem 'rabl', '~> 0.6.0'
gem 'aasm'
gem 'net-ssh', '=2.9.2'
gem 'holidays', '~> 3.1.2'#, git: 'https://github.com/sincola/holidays.git'
gem 'capistrano', require: false
gem 'rvm-capistrano', require: false
gem 'newrelic_rpm', '~> 3.18.1'

gem 'i18n-inflector'

gem 'savon', '~> 0.9.9'
gem "typhoeus", "~> 0.3.3"

gem "exception_notification", "~> 2.6.1"
gem "strip_attributes", "~> 1.0"

gem 'resque', "~> 1.20.0"
gem 'resque_mailer', "~> 2.0.3"
gem 'resque-scheduler', :require => 'resque_scheduler'

gem 'kaminari'
gem 'redis-rails'
gem 'algorithms'

gem 'geocoder'
gem 'timezone', '~> 1.0'

gem 'sugarcrm'
gem 'bluepill'
gem 'groupdate'
gem 'active_median'

gem 'awesome_nested_set'

gem 'tzinfo', '~> 0.3.49'

gem 'active_record_query_trace' # source: https://github.com/ruckus/active-record-query-trace

gem 'slack-notifier', '~> 1.5', '>= 1.5.1'
gem 'nokogiri', '~> 1.6.5'

我的想法是:在我的Gemfile.lock 中重复了不同的宝石,在旧的Gemfile.lock 中有不同的版本

请仔细阅读我的问题,如果您知道如何帮助我,我将无限感谢您。

感谢和问候,

【问题讨论】:

  • 不使用旧的 Gemfile.lock 进行安装时会出现什么错误

标签: ruby-on-rails ruby rspec rubygems


【解决方案1】:

当你尝试运行 bundle install 时,一些 gem 会给你类似 Your bundle is locked to xyz gem (version), but that version could not be found in any of the sources listed in your Gemfile 的错误。要解决此类问题,您必须更新 Gemfile 中的确切版本 = xxx 而不是 ~&gt; xxx

此外,由于依赖于其他 gem,您可能还需要更新 Gemfile.lock 中的锁定 gem。

【讨论】:

  • 谢谢,我可以安装一切问题是规范,我无法成功运行它
【解决方案2】:

Gemfile 没有Gemfile.lock 严格。因此,所有没有限制或软限制的 Gems(例如,~&gt; 4&gt; 4.0)都将更新为新版本,这可能不是最初开发代码时使用的版本,即为什么有些宝石可能会失败。

我还没有时间对您将Gemfile.lock 复制到Gemfile 的尝试进行全面审查,但我看到您使用了一些宝石而没有在您的Gemfile 中指定确切版本,我认为这可能是你的问题。 Gemfile.lock 总是指定确切的版本,所以如果你想复制你的 Gemfile.lock 你应该做同样的事情。例如,对于slack-notifier gem,您使用的是版本1.5.1,但您的Gemfilegem 'slack-notifier', '~&gt; 1.5', '&gt;= 1.5.1',而它应该是gem 'slack-notifier', '1.5.1'

【讨论】:

  • 鉴于它很有用,请您投票或批准答案吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-20
相关资源
最近更新 更多