Rails 4.0.2 depends on old mime-types (~> 1.16) re

2019-09-09 14:43发布

问题:

I am having a compatibility issue with the mechanize gem (2.7.3) because it depends on mime-types 2.0, while Rails 4.0.2 depends on mime-types version (~> 1.16).

Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    rails (= 4.0.2) ruby depends on
      mime-types (~> 1.16) ruby

    mechanize (= 2.7.3) ruby depends on
      mime-types (2.0)

Is there a way to "update" Rails dependencies to the latest version of mime-types?

回答1:

The rails dependency on mime-types ~> 1.16 is because rails depends on the mail gem.

Unfortunately, your only options are to either downgrade to mechanize 2.7.2 (which works with mime-types >= 1.17.2, ~> 1.17) or to fork either mechanize or the mail gem to specify a looser version constraint.

There is an open issue with the mail gem to support mime-types 2.0: https://github.com/mikel/mail/issues/641