How to update Jekyll and theme versions?

Hello!
I have a local repository with a site built for GitHub pages some time ago. Its Jekyll version and minima theme version are somewhat old. In its Gemfile there is:

gem "jekyll", "~> 3.9.2"
gem "minima", "~> 2.0"

group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end

I would like to update it to Jekyll 4.2.1, minima 2.5 and jekyll-feed 0.12.

Is it possible? How to do this?

I tried to simply replace the version numbers in the Gemfile:

gem "jekyll", "~> 4.2.2"
gem "minima", "~> 2.5"

group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
end

and then I ran bundle update. But the result is a series of errors:

Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundler could not find compatible versions for gem "terminal-table":
  In snapshot (Gemfile.lock):
    terminal-table (>= 1.8.0)

  In Gemfile:
    github-pages was resolved to 226, which depends on
      terminal-table (~> 1.4)

    jekyll (~> 4.2.2) was resolved to 4.2.2, which depends on
      terminal-table (~> 2.0)

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

Running again bundle update doesn’t solve the problem.