Bundler could not find compatible versions for gem "jekyll"

Here is my gemfile:

source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#     bundle exec jekyll serve
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 4.2.0"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", "~> 216", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", "~> 1.2"
  gem "tzinfo-data"

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

It is producing the following error:
> bundle update

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

  In Gemfile:
    jekyll (~> 4.2.0)

    github-pages (~> 216) was resolved to 216, which depends on
      jekyll (= 3.9.0)

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

Running bundle update does not fix the issue, it just throws the same error

GHP requires 3.9 - so at same time saying you want it to use 4.2 is probably a problem.

Try changing gem jekyll to 3.9.0?

What are you trying to do? do you really want to use the GHP gem? or are you just trying to get a site going and this is the gemfile you found?

I was just following the Jekyll Quickstart and the GitHub pages documentation.
I ran jekyll new . to create the project then copied the github-pages gem line from github’s website.

I tried changing the jekyll gem to gem "jekyll", "~> 3.9.0" but that prompted:

> bundle install

You have requested:
  jekyll ~> 3.9.0

The bundle currently has jekyll locked at 4.2.0.
Try running `bundle update jekyll`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

Bundle update jekyll returns the same error

there is probably a gemfile.lock (?) file that freezes all the versions at what was originally in the gemfile. Try deleting the lock file.

1 Like

That worked! Thank you so much!

1 Like