【问题标题】:The bundle currently has rails locked at 3.2.12. whats to do?该捆绑包目前在 3.2.12 锁定了导轨。怎么办?
【发布时间】:2015-03-13 09:22:39
【问题描述】:

我已在我的 gemfile 中将 rails 版本从 3.2.12 更改为 4.2.0

然后我得到了这个错误:

The bundle currently has rails locked at 3.2.12

所以我尝试了 bundle update / 和 bundle update rails ...但我得到了这个:

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
prototype-rails (>= 0) ruby depends on
  rails (~> 3.2) ruby

rails (4.2.0)

我该怎么办?

更新 Gemfile:

source 'http://rubygems.org'
#gem 'rails', '3.2.12'
gem 'rails', '4.2.0'
gem "airbrake"
#gem "mysql"
gem 'mysql2',  '~>0.3.7'
gem 'fastercsv'
gem 'newrelic_rpm', :group => [:production, :staging]
gem "xml-simple", :require => "xmlsimple"
gem "will_paginate", "~> 3.0.0"
gem "json", '1.7.7'
gem "default_value_for"
gem "whenever"
gem 'charlock_holmes'
gem 'prototype-rails'
gem 'rails_autolink'

group :development do
  gem 'capistrano'
  gem 'capistrano-ext'
end

【问题讨论】:

  • 显示你的Gemfile
  • 我已经在上面更新了
  • 删除你的 gemfile.lock rm Gemfile.lock
  • 删除你的 gemfile.lock rm Gemfile.lock,然后在你的Gemfile 中添加rails 4.2.0 然后bundle install
  • 在您的application.rb 文件中添加i18n.config.enforce_available_locales = false

标签: ruby-on-rails ruby gem bundle


【解决方案1】:

快跑

bundle update

无需告知只更新特定的 gem(如 rails)。这使bundler 可以找到Gemfile 中所有宝石的最新可能组合。

prototype-rails gem 不再受到积极支持。您应该尽快更换它(即使最新版本仍然适用于您)。

此外:Rails 3.2 and 4.2 之间的多个配置设置已更改,您将不得不更改一些配置和核心文件。您可能还想阅读Rails Guide: Upgrading Rails

我建议以较小的步骤升级您的应用程序(3.2 -> 4.0、4.0 -> 4.1、4.1 -> 4.2)。在继续下一步之前,请确保应用程序在每个步骤中都能正常工作。此外,请注意控制台或日志中的弃用警告。

【讨论】:

  • 感谢提示。 webrick 告诉我很多错误。是否有文档或类似的东西我可以从 3.2 升级到 4.2
  • @Felix:我用升级指南的链接更新了我的答案。
  • 谢谢。我必须做所有的步骤。首先 von 3.2 到 4.0,然后从 4.0 到 4.1,然后从 4.1 到 4.2?
  • @Felix:一个接一个地完成所有步骤很有帮助。每个版本都有小的更改或弃用。更容易发现和解决问题,就像您尝试迈出一大步一样。
  • 在这种情况下:Rails 4.0 no longer supports loading plugins from vendor/plugins. You must replace any plugins by extracting them to gems and adding them to your Gemfile. If you choose not to make them gems, you can move them into, say, lib/my_plugin/* and add an appropriate initializer in config/initializers/my_plugin.rb. 哪种方式更容易? ....
【解决方案2】:

删除你的gemfile.lock

rm Gemfile.lock 

然后添加 rails 4.2.0 在您的 Gemfile 中 那么

bundle install

【讨论】:

  • 错误在 config/application.rb lin 79 I18n.default_locale = Settings.default_locale.to_sym
  • 将此行添加到application.rb文件i18n.config.enforce_available_locales = false
  • 代替我的还是另外的`?
  • 您将拥有 i18n.config.enforce_available_locales = true 只需将其设置为 false
【解决方案3】:

我认为,问题出在原型导轨上

https://github.com/rails/prototype-rails

prototype-rails gem 的下方评论 很遗憾,由于人力和资源有限,Rails 核心团队无法确认该 gem 当前是否适用于 Rails 4.1 及更高版本。如果您在升级应用程序时发现任何问题,请在问题跟踪器上报告它们,或者更好的是,通过发送拉取请求提交补丁。

尝试删除先删除原型导轨然后运行

bundle update

【讨论】:

    猜你喜欢
    • 2014-07-15
    • 2019-08-11
    • 2011-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多