【问题标题】:Bundler could not find compatible versionsBundler 找不到兼容版本
【发布时间】:2021-08-11 12:28:31
【问题描述】:

我的应用中有多个 gem 失败。我的捆绑器无法为所有人找到兼容的版本。我也没有“Gemfile.lock”,也没有在bundle install 上创建。如下:

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    draper was resolved to 2.1.0, which depends on
      actionpack (>= 3.0)

    jquery-datatables-rails (~> 3.3.0) was resolved to 3.3.0, which depends on
      actionpack (>= 3.1)

    rails (= 4.1.6) was resolved to 4.1.6, which depends on
      actionpack (= 4.1.6)

    rails-api was resolved to 0.4.1, which depends on
      actionpack (>= 3.2.11)

    ransack was resolved to 1.8.10, which depends on
      actionpack (< 5.2, >= 3.0)

    redis-rails was resolved to 5.0.2, which depends on
      redis-actionpack (< 6, >= 5.0) was resolved to 5.1.0, which depends on
        actionpack (< 7, >= 4.0)

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    acts_as_api (= 1.0.1) was resolved to 1.0.1, which depends on
      activemodel (>= 3.0.0)

    carrierwave (>= 1.0.0.beta, < 2.0) was resolved to 1.3.2, which depends on
      activemodel (>= 4.0.0)

    paperclip (~> 4.3.2) was resolved to 4.3.7, which depends on
      activemodel (>= 3.2.0)

    rails (= 4.1.6) was resolved to 4.1.6, which depends on
      activemodel (= 4.1.6)

Bundler could not find compatible versions for gem "activerecord":
  In Gemfile:
    activerecord-postgres-hstore was resolved to 0.7.8, which depends on
      activerecord (>= 3.1)

    audited (~> 4.7) was resolved to 4.8.0, which depends on
      activerecord (< 5.3, >= 4.0)

    rails (= 4.1.6) was resolved to 4.1.6, which depends on
      activerecord (= 4.1.6)

我正在使用以下规格再次尝试并获得相同的结果。 捆绑器:1.16.6 导轨:4.1.6 红宝石:2.3.8 ubuntu:18.04

当我执行 gem list 时,我可以看到我的 gem,但它仍然说 bundler 无法为 rails 4.1.6 找到任何东西。

【问题讨论】:

  • 你的 Ruby 版本是什么?你的捆绑器版本是什么?
  • 你只需要降级洗劫?其他一切似乎都符合您的“rails = 4.1.6”要求
  • 我的 ruby​​ 版本是 2.7.1,bundler 版本是 1.17.3
  • 尝试使用 ruby​​ 2.3.8 和 bundler 1.16.6 和 rails 4.1.6 但仍然是同样的问题。机器是否有可能阻止捆绑程序或任何东西来搜索并获取所需的宝石?

标签: ruby-on-rails ruby rubygems bundle gemfile


【解决方案1】:

在您的 Gemfile 中添加 source,如下所示:

宝石文件

source 'https://rubygems.org'

删除Gemfile.lock 中的所有内容并运行bundle install

【讨论】:

  • 我的 Gemfile 中已经有 source,但我没有 Gemfile.lock
猜你喜欢
  • 2011-10-31
  • 2017-07-17
  • 2018-02-09
  • 2014-05-26
  • 2014-03-14
  • 2013-03-13
  • 2019-05-07
  • 2016-02-17
  • 2013-03-12
相关资源
最近更新 更多