TYPO3从11.5升级到12.4时composer依赖冲突(psr/http-message)
TYPO3 11.5 升级到12.4的依赖冲突问题
正在将TYPO3网站从11.5版本升级到12.4版本,已解决PHP版本问题(修改了composer.json和Docker配置并重启容器),但在Docker内执行composer update --dry-run时出现依赖冲突,具体错误信息如下:
typ/toolbox/bc-docker.sh call_composer update --dry-run Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires t3g/blog ^12.0.2 -> satisfiable by t3g/blog[12.0.2]. - t3g/blog 12.0.2 requires psr/http-message ^1.0 -> satisfiable by psr/http-message[1.0, 1.0.1, 1.1]. - You can only install one version of a package, so only one of these can be installed: psr/http-message[1.0, 1.0.1, 1.1, 2.0]. - tomasnorre/crawler 12.0.4 requires psr/http-message ^2.0 -> satisfiable by psr/http-message[2.0]. - Root composer.json requires tomasnorre/crawler ^12.0.4 -> satisfiable by tomasnorre/crawler[12.0.4]. Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
冲突原因是t3g/blog 12.0.2依赖psr/http-message ^1.0,而tomasnorre/crawler 12.0.4依赖psr/http-message ^2.0,两者无法共存。原本期望Composer自动解决冲突,但担心使用-W选项会影响其他依赖。
当前composer.json的require部分内容如下:
"require": { "typo3/minimal": "^12.4.0", "typo3/cms-belog": "^12.4.0", "typo3/cms-beuser": "^12.4.0", "typo3/cms-fluid-styled-content": "^12.4.0", "typo3/cms-impexp": "^12.4.0", "typo3/cms-indexed-search": "^12.4.0", "typo3/cms-info": "^12.4.0", "typo3/cms-lowlevel": "^12.4.0", "typo3/cms-redirects": "^12.4.0", "typo3/cms-rte-ckeditor": "^12.4.0", "typo3/cms-scheduler": "^12.4.0", "typo3/cms-seo": "^12.4.0", "typo3/cms-setup": "^12.4.0", "typo3/cms-tstemplate": "^12.4.0" }
解决方案建议
- 优先检查扩展更新:查看
t3g/blog是否有高于12.0.2的版本,支持TYPO3 12.4同时兼容psr/http-message ^2.0。如果存在这类版本,修改composer.json中t3g/blog的版本约束为更高范围(比如^12.0),再重新执行composer update --dry-run。 - 评估
-W选项的影响:先执行composer update --dry-run -W,查看命令输出中会被升级、降级或移除的包列表。如果只有psr/http-message和相关冲突扩展的版本调整,且不影响TYPO3核心包或其他业务依赖,再实际执行带-W的更新命令。 - 临时替代方案:如果
t3g/blog暂无兼容psr2的版本,可考虑暂时禁用该扩展(业务允许的情况下),或者查找社区提供的兼容补丁,待扩展更新后再重新安装。
内容的提问来源于stack exchange,提问作者user26875548
相关产品推荐
相关产品推荐

