jeremywat
jeremywat

Reputation: 1044

How do I force a gem file to be installed when the the dependency doesn't match?

I'm building a Jekyll site and I need to be able to convert pages to PDF. I want to use jekyll-pdf but when I include it, bundle tells me it's incompatible:

Because every version of jekyll-pdf depends on jekyll >= 3.1, < 4.A
  and Gemfile depends on jekyll ~> 4.3.3,
  jekyll-pdf cannot be used.

Looking at the jekyll-pdf repo it seems like it's no longer maintained so I don't expect this to change. Is there a way to force bundle to install that gem even though the dependency isn't valid?

Upvotes: 1

Views: 46

Answers (1)

maikhel
maikhel

Reputation: 426

It's impossible to install existing jekyll-pdf gem if your jekyll version is 4.x. But you can fork jekyll-pdf repo and upgrade the jekyll dependency in .gemspec file, like:

  spec.add_runtime_dependency "jekyll", ">= 2.0", "~> 4.0"

Then use your updated version in Gemfile, like:

gem 'jekyll-pdf', git: 'https://github.com/your-github/forked-repo'

Be aware that jekyll-pdf gem might work only for older versions of jekyll, using newer might result in unexpected behaviours or bugs.

Upvotes: 1

Related Questions