【问题标题】:Bundler could not find compatible versions for gem "activemodel"Bundler 找不到 gem “activemodel” 的兼容版本
【发布时间】:2014-05-26 01:49:18
【问题描述】:

尝试在 rails 4.1 中安装 mongoid 3.1.6

Bundler 找不到 gem "activemodel" 的兼容版本: 在 Gemfile 中:

mongoid (~> 3.1.6) ruby depends on
  activemodel (~> 3.2) ruby

rails (= 4.1.0) ruby depends on
  activerecord (= 4.1.0) ruby depends on
    activemodel (4.1.0)

当 mongoid 降级到 1.0.6 时它工作正常,但我需要在 rails 4.1 中使用 mongoid 3.1.6。 有什么办法可以解决这个问题吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 mongoid mongoid3 ruby-2.1


    【解决方案1】:

    您需要使用 4.x 版本的 mongoid,它使用 activemodel >= 4.0.0。这是最新的:

    gem 'mongoid', '~> 4.0.0'
    

    【讨论】:

    • 它工作得很好,谢谢,但现在我在启动 rails 服务器未初始化常量 Sprockets::Rails::VERSION (NameError) 时出现此错误
    • 您是否要将现有应用程序从 Rails 3.2.x 升级到 4?或者,从头开始?我认为这是某个地方的另一个 gem 依赖问题。
    • 从头开始一个新的应用程序,使用 ruby​​ 2.1.1, rails 4.1
    • 对此的小更新 - 作者已经发布了 Mongoid gem 4.0.0 版,更多详细信息请参阅rubygems.org/gems/mongoid
    猜你喜欢
    • 2011-10-31
    • 2017-07-17
    • 2018-02-09
    • 2014-03-14
    • 2013-03-13
    • 2019-05-07
    • 2016-02-17
    • 2013-03-12
    • 2012-04-08
    相关资源
    最近更新 更多