Search code examples
rubyrubygemsbundlerjekyll-theme

Jekyll: Bundler could not find compatible versions for gems


I'm new to Jekyll and I'm trying to install new themes for my test-project in order to find which one is more suitable.

Basically, this is the procedure I follow:

  1. download (or clone) sources the theme to ~/gems/gems/
  2. enter in ~/gems/gems/<new_theme> directory
  3. run bundle install
  4. if it works, go to my project folder and
  5. edit both Gemfile and _config.yml with the name
  6. run bundle install

So far I tried at least 5-6 themes and none worked. Most of the times I get this kind of error:

Bundler could not find compatible versions for gem "jekyll":
  In snapshot (Gemfile.lock):
    jekyll (= 4.0.0)

  In Gemfile:
    jekyll (~> 4.0.0)

    jekyll-theme-clean-blog was resolved to 4.0.1, which depends on
      jekyll (~> 3.6)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

But I cannot understand it. Gemfile.lock says the version of jekyll is 4.0.0 Gemfile says the required version of jekyll is greater or equal than 4.0.0 -> OK jekyll-theme-clean-blog depens on jekyll greater or equal than 3.6 -> OK

So why it fails? I have version 4.0.0 that is greater than 3.6 as stated by the dependency chain. Where's my fault here?


Solution

  • **jekyll-theme-clean-blog was resolved to 4.0.1, which depends on
      jekyll (~> 3.6)
    

    means that Bundler wants to use version 4.0.1 of the jekyll-theme-clean-blog but that versions depends on ~> 3.6 of jekyll.

    ~> 3.6 is a shortcut for >= 3.6 && < 4.0. Therefore `jekyll 4.0.0 does not match.

    You have two options:

    1. Because Bundler already found one of the latest version of jekyll-theme-clean-blog and that the latest version still requires jekyll ~> 3.8.5 you must downgrade jekyll to ~> 3.6 or
    2. you must get rid of jekyll-theme-clean-blog gem at all.