Composer 2.0 问题
Posted
技术标签:
【中文标题】Composer 2.0 问题【英文标题】:Composer 2.0 Problems 【发布时间】:2021-03-19 07:22:34 【问题描述】:最近我试图在我通过 Composer 工作的项目上安装一个包。安装后,我收到一条消息,提示 Composer 2.0 已发布,并询问我是否要更新它。通常它看起来像是一个稳定的版本,但在更新时没有安装软件包并且弹出了这个错误。
composer require spatie/laravel-tags
Using version ^3.0 for spatie/laravel-tags
./composer.json has been updated
Running composer update spatie/laravel-tags
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 laravel/framework 8.0, found laravel/framework[v8.0.0] but the package is fixed to v7.30.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Problem 2
- spatie/laravel-tags[3.0.0, ..., 3.0.1] require laravel/framework ^8.0 -> found laravel/framework[v8.0.0, ..., 8.x-dev] but the package is fixed to v7.30.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires spatie/laravel-tags ^3.0 -> satisfiable by spatie/laravel-tags[3.0.0, 3.0.1].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
任何人都遇到过这个问题或有任何指导我该如何解决这个问题?
谢谢
【问题讨论】:
请分享更多细节 - 给定的问题在我看来与 Composer v2 无关,但与安装在 v7.30.0 中的laravel/framework
相关(如错误消息告诉您的那样)
@NicoHaase 是的,我的错......它与作曲家 v2 无关......作曲家依赖项中的版本不匹配。我在下面回答了什么解决了我的问题。
【参考方案1】:
我通过先运行 composer outdated -D 并手动更新 composer.json 中 laravel/framework 的版本然后运行 composer update 解决了这个问题。
【讨论】:
以上是关于Composer 2.0 问题的主要内容,如果未能解决你的问题,请参考以下文章