AlwaysLearning
AlwaysLearning

Reputation: 23

Unable to update dompdf via Composer in Drupal 8

We are in the midst of trying to get all of our Drupal modules that were not installed using Composer to be managed within Composer.

After clearing Composer's cache, we ran the following:

./composer require dompdf/dompdf;

This returns:

./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - dompdf/dompdf v0.8.0 requires phenx/php-svg-lib 0.2.* -> satisfiable by phenx/php-svg-lib[v0.2].
    - Installation request for dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0].
    - Installation request for phenx/php-svg-lib (locked at 0.1) -> satisfiable by phenx/php-svg-lib[0.1].

Installation failed, reverting ./composer.json to its original content.

It seems like the proper thing to do would be to not lock "phenx/php-svg-lib" to version 0.1, then upgrade dompdf, however when we modified dompdf's composer.json file to require phenx/php-svg-lib version 0.2.*, clearcache, then try require again, we get the same error as above, which still references the lock at 0.1. I've also confirmed that dompdf is the only vendor module that is using phenx/php-svg-lib.

Also, is there a reason why "Can only install one of" is listed three times?

Thank you in advance for any advice.

Upvotes: 2

Views: 1423

Answers (1)

bbujisic
bbujisic

Reputation: 506

It appears like this problem happens when updating dompdf from version 0.7.0 to 0.8.0. For some reason, the update works perfectly fine with composer 1.2.x, but does result with the above error with version 1.4.x.

The fix that did the job for me was to remove

"dompdf/dompdf": "^0.7.0"

from the composer.json file and then run:

composer update

The result should be something like:

> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 3 removals
  - Removing dompdf/dompdf (v0.7.0)
  - Removing phenx/php-font-lib (0.4)
  - Removing phenx/php-svg-lib (0.1)
Writing lock file
Generating autoload files

Then require a new version:

composer require dompdf/dompdf

Upvotes: 5

Related Questions