锁定文件不是最新的 composer.json 中的最新更改
Posted
技术标签:
【中文标题】锁定文件不是最新的 composer.json 中的最新更改【英文标题】:The lock file is not up to date with the latest changes in composer.json 【发布时间】:2019-04-16 21:59:41 【问题描述】:我正在尝试克隆一个 github 存储库并在其上发出 composer install
。但我得到了这个:
警告:。您可能会得到过时的依赖项。运行 update 来更新它们。
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/polyfill-intl-icu v1.9.0
- Installation request for symfony/polyfill-intl-icu v1.9.0 -> satisfiable by symfony/polyfill-intl-icu[v1.9.0].
- Conclusion: remove symfony/process v3.4.15
- symfony/polyfill-intl-icu v1.9.0 requires symfony/intl ~2.3|~3.0|~4.0 -> satisfiable by symfony/symfony[v4.0.0].
- don't install symfony/process v3.4.15|remove symfony/symfony v4.0.0
- don't install symfony/symfony v4.0.0|don't install symfony/process v3.4.15
- Installation request for symfony/process v3.4.15 -> satisfiable by symfony/process[v3.4.15].
运行时composer update
Problem 1
- Conclusion: don't install symfony/symfony v4.1.7
- Conclusion: don't install symfony/symfony v4.1.6
- Conclusion: don't install symfony/symfony v4.1.5
- Conclusion: don't install symfony/symfony v4.1.4
- Conclusion: don't install symfony/symfony v4.1.3
- Conclusion: don't install symfony/symfony v4.1.2
- Conclusion: don't install symfony/symfony v4.1.1
- Conclusion: don't install symfony/symfony v4.1.0
- Conclusion: don't install symfony/symfony v4.0.14
- Conclusion: don't install symfony/symfony v4.0.13
- Conclusion: don't install symfony/symfony v4.0.12
- Conclusion: don't install symfony/symfony v4.0.11
- Conclusion: don't install symfony/symfony v4.0.10
- Conclusion: don't install symfony/symfony v4.0.9
- Conclusion: don't install symfony/symfony v4.0.8
- Conclusion: don't install symfony/symfony v4.0.7
- Conclusion: don't install symfony/symfony v4.0.6
- Conclusion: don't install symfony/symfony v4.0.5
- Conclusion: don't install symfony/symfony v4.0.4
- Conclusion: don't install symfony/symfony v4.0.3
- Conclusion: don't install symfony/symfony v4.0.2
- Conclusion: don't install symfony/symfony v4.0.1
- Conclusion: remove symfony/symfony v4.0.0
- don't install symfony/symfony v4.0.0|remove symfony/process v3.4.15
- don't install symfony/process v3.3.0|don't install symfony/symfony v4.0.0
composer.json(需要部分)
"require":
"php": ">=7.1",
"symfony/symfony": "~4.0",
"symfony/process": "^3.3",
"doctrine/orm": "dev-fork as 2.5.6",
"doctrine/doctrine-bundle": "1.*",
"symfony/swiftmailer-bundle": "~3.1",
"symfony/monolog-bundle": "~3.1",
"sensio/framework-extra-bundle": "^5.1",
"graylog2/gelf-php": "^1.4",
"doctrine/doctrine-migrations-bundle": "^1.1",
"awt/webauth-bundle": "3.0.*",
"awt/canvas-client-bundle": "6.2.*"
【问题讨论】:
试试composer update
分享您的require
部分composer.json
symfony/symfony
也包括symfony/process
。这会导致冲突,因为一个包不能安装在两个版本中。 Composer 中存在一个错误,导致在以前的版本中错误地允许这样做,但在 Composer 1.7.3 中修复了这个错误。您现在需要删除 symfony/process
依赖项并坚持使用 3.4 版中的 Process 组件,或者如果您需要更新版本的 Process 组件(或将 symfony/symfony
更新到 4.1)明确要求所有 Symfony 组件。
@Trix 已编辑以包含要求部分
@ImanaliMamadiev 我确实运行了 composer update 并得到了类似的错误
【参考方案1】:
运行:composer update --lock
以使您的锁定文件与您的 composer.json 同步。
【讨论】:
当没有冲突时,这是正确的做法。【参考方案2】:你可以在 composer 上使用depends
& prohibits
来看看你到底应该做什么:
composer depends symfony/process 3.4.15
和
composer prohibits symfony/symfony 4
这两个命令告诉你什么是冲突以及你应该做什么。
主要问题是您的composer.json
和composer.lock
不同步。第一个文件告诉作曲家需要什么包及其版本限制,第二个文件在协作者之间共享完全相同的包版本,以保持一致性。
如果存储库所有者无法帮助您解决此问题,您唯一的方法是:
rm composer.lock
rm -rf vendor
composer install
这将删除供应商目录内容并安装所有依赖项的新副本,仅根据 composer.json
【讨论】:
【参考方案3】:请分享你的 comooser.json 文件,我认为你应该更新它:
"require":
"symfony/process": "3.4.*",
"symfony/symfony": "3.4.*"
,
或
"require":
"symfony/process": "4.1.*",
"symfony/symfony": "4.1.*"
,
【讨论】:
已编辑以包含 composer.json 的 require 部分 请为您的答案添加一些解释。为什么要更改composer.json
中的某些文件内容来解决给定的警告?【参考方案4】:
解决方案是从网站手动下载之前版本的 composer (1.7.2) 并覆盖我的 1.7.3 版本。
【讨论】:
冲突的composer.json
& composer.lock
文件无法通过重新安装其他版本的 composer 得到解决以上是关于锁定文件不是最新的 composer.json 中的最新更改的主要内容,如果未能解决你的问题,请参考以下文章