rails/middleman 依赖项需要不同版本的 gem

rails/middleman dependencies requires different versions of a gem

我试图将 middleman-cloudfront gem 添加到我的中间人项目中,但出现以下错误。大多数 gem 需要 >= 4.0 版本的 middleman-core gem,但 middleman-cloudfront 需要 ~> 3.0 版本。

我该如何解决这个问题?

Bundler could not find compatible versions for gem "middleman-core":

In Gemfile:
middleman (>= 4.0.0) was resolved to 4.0.0, which depends on
  middleman-core (= 4.0.0)

middleman-cloudfront (~> 0.2.1) was resolved to 0.2.1, which depends on
  middleman-core (~> 3.0)

middleman-google-analytics (>= 2.1.1, ~> 2.1) was resolved to 2.1.1, which depends on
  middleman-core (>= 3.4)

middleman-s3_sync (>= 4.0.3, ~> 4.0) was resolved to 4.0.3, which depends on
  middleman-core (>= 4.0.0)

middleman-s3_sync (>= 4.0.3, ~> 4.0) was resolved to 4.0.3, which depends on
  middleman-core (>= 4.0.0)

middleman-sprockets (~> 4.0) was resolved to 4.0.0, which depends on
  middleman-core (~> 4.0)

看起来像 support for v4 has been added to middleman-cloudfront,但尚未作为新版本发布。你可以直接从 master:

gem 'middleman-cloudfront', github: 'andrusha/middleman-cloudfront'