8
4

More than 3 years have passed since last update.

「Bundler could not find compatible versions for gem」なとき

Posted at

概要

  • rails tutorial(2020/1/3現在)にあるとおりにgemfileを編集してbundle installを実行したら、うまくいかなかったときの話。

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    rails (~> 6.0.2, >= 6.0.2.1) was resolved to 6.0.2.1, which depends on
      actionpack (= 6.0.2.1)

    rails-controller-testing (= 1.0.2) was resolved to 1.0.2, which depends on
      actionpack (~> 5.x, >= 5.0.1)

Bundler could not find compatible versions for gem "listen":
  In Gemfile:
    listen (>= 3.0.5, < 3.2)

    guard (= 2.13.0) was resolved to 2.13.0, which depends on
      listen (>= 2.7, <= 4.0)

    spring-watcher-listen (~> 2.0.0) was resolved to 2.0.1, which depends on
      listen (>= 2.7, < 4.0)

解決方法&参考にした情報

  • 「インストールしたいバージョンの指定を、もっとゆるくしてあげればいいんだよ」
  • 例)
    • gem 'rspec-rails', '3.3.2' ではなく
    • gem 'rspec-rails', '~> 3.3' のようにする
  • https://github.com/bundler/bundler/issues/7034

参考までに私の修正した部分

修正前


・・・
  gem 'rails-controller-testing', '1.0.2'
  gem 'minitest',                 '5.13.0'
  gem 'minitest-reporters',       '1.1.14'
・・・

修正後


・・・
  gem 'rails-controller-testing', '~> 1.0.2'
  gem 'minitest',                 '~> 5.13.0'
  gem 'minitest-reporters',       '~> 1.1.14'
・・・
8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4