composer安装错误与PHP 8.0.17和drupal 9



我遇到了非常不寻常的问题。我有一个drupal 9.2.18网站与php 7.4工作我想更新到php 8,最初我试图在8.0而不是8.1。当我做composer update时,由于php版本检查,它升级/降级了一些插件,它也将作曲家api版本更新到2.3.0。编写器更新在我的本地实例中工作正常。之后,当我在本地运行composer install时,它也能正常工作。

然而,当我在eks服务器上上传代码并启动构建过程时,composer install失败了。我进行了故障排除,发现服务器上不存在供应商文件夹的原因,composer安装从锁定文件下载所有插件,并在更新依赖项后失败。我在本地尝试了相同的场景,并能够重现错误。PHP 8.0.17作曲家2.3.5

下面的步骤

composer update//works fine

rm -rf vendor//删除供应商模拟服务器

composer install//出现如下错误

PHP Fatal error: Declaration of ComposerDependencyResolverRule2Literals::getLiterals() must be compatible with ComposerDependencyResolverRule::getLiterals(): array in /cms/vendor/composer/composer/src/Composer/DependencyResolver/Rule2Literals.php on line 48

Fatal error: Declaration of ComposerDependencyResolverRule2Literals::getLiterals() must be compatible with ComposerDependencyResolverRule::getLiterals(): array in /cms/vendor/composer/composer/src/Composer/DependencyResolver/Rule2Literals.php on line 48

编辑:Composer的版本是2.2.12,现在得到这个错误

运行编写器更新以应用合并设置收集根包的补丁。

DrupalProject 作曲家 ScriptHandler:: checkComposerVersion用包信息加载编写器存储库PHP致命错误:声明ReactPromiseRejectedPromise::then(?callable $ oncompleted = null, ?callable $onRejected = null, ?callable $onProgress = null)必须兼容ReactPromisePromiseInterface::then($ compleledhandler = null, $errorHandler = null, $progressHandler = null)在/var/ww/d9/vendor/React/Promise/src/rejectedpromise .php第21行

致命错误:声明ReactPromiseRejectedPromise::then(?callable $ oncompleted = null, ?callable $onRejected = null, ?callable $onProgress = null)必须兼容ReactPromisePromiseInterface::then($ compleledhandler = null, $errorHandler = null, $progressHandler = null)在/var/ww/d9/vendor/React/Promise/src/rejectedpromise .php第21行

作曲家。Json如下所示,有几行来自我们的repo,比如patch和contrib_override模块,但这些可以被跳过,因为问题与这些无关

{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "",
"role": ""
}
],
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "package",
"package": {
"name": "ckeditor/find",
"version": "4.14.1",
"type": "drupal-library",
"extra": {
"installer-name": "ckeditor/plugins/find"
},
"dist": {
"url": "https://download.ckeditor.com/find/releases/find_4.14.1.zip",
"type": "zip"
}
}
},
{
"type": "package",
"package": {
"name": "ckeditor/liststyle",
"version": "4.8.0",
"type": "drupal-library",
"extra": {
"installer-name": "ckeditor/plugins/liststyle"
},
"dist": {
"url": "https://download.ckeditor.com/liststyle/releases/liststyle_4.8.0.zip",
"type": "zip"
}
}
},
{
"type": "package",
"package": {
"name": "ckeditor/pastefromword",
"version": "4.15.1",
"type": "drupal-library",
"extra": {
"installer-name": "ckeditor/plugins/pastefromword"
},
"dist": {
"url": "https://download.ckeditor.com/pastefromword/releases/pastefromword_4.15.1.zip",
"type": "zip"
}
}
}
],
"require": {
"php": ">=8.0",
"ckeditor/liststyle": "4.8.0",
"ckeditor/pastefromword": "4.15.1",
"composer/installers": "^1.9",
"cweagans/composer-patches": "^1.7",
"drupal/admin_toolbar": "^2.2",
"drupal/allowed_formats": "^1.2",
"drupal/bootstrap_barrio": "^4.24",
"drupal/ckeditor_font": "^1.1",
"drupal/ckeditor_liststyle": "^1.3",
"drupal/conditional_fields": "^1.0@alpha",
"drupal/config_ignore": "^2.2",
"drupal/console": "^1.9.7",
"drupal/core-composer-scaffold": "9.2.18",
"drupal/core-dev": "9.2.18",
"drupal/core-project-message": "9.2.18",
"drupal/core-recommended": "9.2.18",
"drupal/csv_serialization": "^1.4",
"drupal/date_popup_timepicker": "^1.0@alpha",
"drupal/devel": "^4.1",
"drupal/duration_field": "^2.0",
"drupal/entity": "^1.0",
"drupal/eva": "^2.0",
"drupal/field_group": "^3.0",
"drupal/fontawesome": "^2.16",
"drupal/link_iframe_formatter": "1.x-dev",
"drupal/meta_position": "^1.0",
"drupal/optional_end_date": "^1.0",
"drupal/pathauto": "^1.6",
"drupal/s3fs": "^3.0",
"drupal/smtp": "^1.0@RC",
"drupal/twig_tweak": "^2.6",
"drupal/typed_data": "^1.0@beta",
"drupal/ultimate_cron": "^2.0@alpha",
"drupal/upgrade_status": "^3.12",
"drupal/video_embed_field": "^2.4",
"drupal/video_embed_vzaar": "^1.0",
"drupal/view_custom_table": "^1.3",
"drupal/view_unpublished": "^1.0@alpha",
"drupal/views_autocomplete_filters": "^1.3",
"drupal/views_conditional": "^1.0",
"drupal/views_data_export": "^1.0",
"drupal/views_ef_fieldset": "^1.4",
"drupal/weight": "^3.1",
"drupal/workflow": "^1.1",
"drush/drush": "^10.3",
"firebase/php-jwt": "^5.2",
"h4cc/wkhtmltopdf-amd64": "^0.12.4",
"smalot/pdfparser": "^0.16.2",
"vlucas/phpdotenv": "^5.1",
"wa72/htmlpagedom": "1.3.*",
"webflo/drupal-finder": "^1.2",
"wikimedia/composer-merge-plugin": "^2.0",
"zaporylie/composer-drupal-optimizations": "^1.0"
},
"require-dev": {
"phpspec/prophecy-phpunit": "^2",
"phpstan/phpstan": "^1.2"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/console-extend-plugin": true,
"cweagans/composer-patches": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true,
"wikimedia/composer-merge-plugin": true,
"zaporylie/composer-drupal-optimizations": true,
"kylekatarnls/update-helper": true
}
},
"autoload": {
"classmap": [
"scripts/composer/ScriptHandler.php"
],
"files": ["load.environment.php"]
},
"scripts": {
"pre-install-cmd": [
"DrupalProject\composer\ScriptHandler::checkComposerVersion"
],
"pre-update-cmd": [
"DrupalProject\composer\ScriptHandler::checkComposerVersion"
],
"post-install-cmd": [
"DrupalProject\composer\ScriptHandler::createRequiredFiles"
],
"post-update-cmd": [
"DrupalProject\composer\ScriptHandler::createRequiredFiles"
]
},
"extra": {
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"]
},
"merge-plugin": {
"include": [
"web/modules/contrib_override/*/composer.json",
"web/modules/contrib_override/printable/modules/printable_pdf/composer.json",
"web/modules/custom/*/composer.json"
],
"recurse": true,
"merge-dev": true
},
"enable-patching": true,
"patches": {
"drupal/core" : {
"Core fields delta not consider as change" : "web/patches/core-fields-delta-not-consider-as-change.patch"
}
}
}
}

得到了一些线索,如果我不允许这个插件进行更改,那么我的问题得到解决,现在作曲家安装工作良好,即使删除供应商文件夹

kylekatarnls/update-helper contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "kylekatarnls/update-helper" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] n

虽然不确定这个插件更新

相关内容

  • 没有找到相关文章

最新更新