Alw*_*ing 2 drupal dompdf drupal-8 composer-php
我们正在尝试让所有未使用 Composer 安装的 Drupal 模块在 Composer 中进行管理。
清除 Composer 的缓存后,我们运行以下命令:
./composer require dompdf/dompdf;
Run Code Online (Sandbox Code Playgroud)
这将返回:
./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.
Run Code Online (Sandbox Code Playgroud)
似乎正确的做法是不要将“phenx/php-svg-lib”锁定到 0.1 版,然后升级 dompdf,但是当我们修改 dompdf 的 composer.json 文件以要求 phenx/php-svg-lib 0.2 版时.*, clearcache,然后再次尝试 require ,我们得到和上面一样的错误,仍然引用了 0.1 处的锁。我还确认 dompdf 是唯一使用 phenx/php-svg-lib 的供应商模块。
另外,是否有“只能安装其中之一”被列出三遍的原因?
预先感谢您的任何建议。
小智 5
dompdf从版本更新0.7.0到0.8.0. 出于某种原因,更新与 composer 完美配合1.2.x,但确实导致 version 出现上述错误1.4.x。
为我完成这项工作的修复方法是删除
"dompdf/dompdf": "^0.7.0"
Run Code Online (Sandbox Code Playgroud)
从composer.json文件然后运行:
composer update
Run Code Online (Sandbox Code Playgroud)
结果应该是这样的:
> 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
Run Code Online (Sandbox Code Playgroud)
然后需要一个新版本:
composer require dompdf/dompdf
Run Code Online (Sandbox Code Playgroud)