TYPO3 10.x升级至11.x的Composer依赖冲突问题求助
解决TYPO3 10.x升级至11.x的Composer依赖冲突问题
问题背景
首次尝试用Composer将TYPO3从10.x版本升级到11.x,执行composer update "typo3/cms-core:11.5.32" --dry-run后仍存在依赖冲突,无法完成升级。
初始错误信息
Problem 1 - 根目录composer.json要求typo3/cms-core ^11.5,找到typo3/cms-core[v11.5.0, ..., v11.5.32]但未加载,大概率是因为与其他依赖冲突。 Problem 2 - 根目录composer.json要求typo3/cms-extbase ^11.5,找到typo3/cms-extbase[v11.5.0, ..., v11.5.32]但未加载,大概率是因为与其他依赖冲突。 Problem 3 - 根目录composer.json要求typo3/cms-backend ^11.5,找到typo3/cms-backend[v11.5.0, ..., v11.5.32]但未加载,大概率是因为与其他依赖冲突。 Problem 4
执行更新命令后的错误
执行命令:composer update "typo3/cms-core:11.5.32" --dry-run
Problem 1 - 根目录composer.json要求typo3/cms-core ^10.4 || 11.*,找到typo3/cms-core[v10.4.0, ..., v10.4.37, v11.0.0, ..., v11.5.32]但未加载,大概率是因为与其他依赖冲突。 Problem 2 - typo3/cms-base-distribution被锁定在版本v10.4.3,且未请求更新该包。 - typo3/cms-base-distribution v10.4.3要求typo3/cms-core ^10.4.0 -> 找到typo3/cms-core[v10.4.0, ..., v10.4.37]但与临时更新约束(typo3/cms-core:11.5.32)冲突。 Problem 3 - typo3/cms-extbase被锁定在版本v10.4.37,且未请求更新该包。 - typo3/cms-extbase v10.4.37要求typo3/cms-core 10.4.37 -> 找到typo3/cms-core[v10.4.37]但与临时更新约束(typo3/cms-core:11.5.32)冲突。
composer.json配置
{ "require": { "typo3/cms-base-distribution": "^10.4", "typo3/cms-core": "^10.4 || 11.*", "typo3/cms-extbase": "^10.4 || 11.*" }, "config": { "allow-plugins": { "typo3/class-alias-loader": true, "typo3/cms-composer-installers": true } } }
composer why-not命令输出
执行命令:composer why-not typo3/cms-core 11.5.32
typo3/cms-core v11.5.32 需要 egulias/email-validator (^3.2.1) __root__ - 需要 egulias/email-validator (^2.1) typo3/cms-core v11.5.32 需要 guzzlehttp/guzzle (^7.7.0) __root__ - 未要求 guzzlehttp/guzzle (但已安装6.5.8版本) typo3/cms-core v11.5.32 需要 guzzlehttp/psr7 (^2.4.3) __root__ - 未要求 guzzlehttp/psr7 (但已安装1.9.1版本) typo3/cms-core v11.5.32 需要 typo3/cms-cli (^3.1) __root__ - 未要求 typo3/cms-cli (但已安装2.0.0版本)
解决方案步骤
1. 修正composer.json的依赖约束
将基础发行版和核心组件的版本统一指向11.x,替换原require内容:
{ "require": { "typo3/cms-base-distribution": "^11.5", "typo3/cms-core": "^11.5.32", "typo3/cms-extbase": "^11.5.32" }, "config": { "allow-plugins": { "typo3/class-alias-loader": true, "typo3/cms-composer-installers": true } } }
2. 强制更新所有关联依赖
执行命令让Composer自动处理第三方依赖的版本升级:
composer update --with-all-dependencies
3. 解锁锁定包并重新升级(若步骤2无效)
如果仍有锁定包冲突,直接指定要升级的包并解锁依赖:
composer update typo3/cms-base-distribution typo3/cms-core typo3/cms-extbase --with-dependencies
4. 验证升级可行性(可选)
再次执行dry-run确认无冲突:
composer update "typo3/cms-core:11.5.32" --dry-run
内容的提问来源于stack exchange,提问作者Ralho
相关产品推荐
相关产品推荐

