gpt4 book ai didi

How to explain Composer's error log?(如何解释Composer的错误日志?)

转载 作者:bug小助手 更新时间:2023-10-24 20:12:18 26 4
gpt4 key购买 nike



I did a lot of research on the web, but did not find a documentation of the composer error log. In the discussions I found, nobody had an explanation that was consistent with the error log. For example:

我在网上做了很多研究,但没有找到Composer错误日志的文档。在我发现的讨论中,没有人有与错误日志一致的解释。例如:





I know, what composer does and can resolve issues on my own, but I often have to consult packagist.org for this. Despite being quite (and unnecessarily) verbose, the composer log only gives me some hints. It does not really point out the concrete problems.

我知道Composer做什么,我自己能解决什么问题,但我经常不得不咨询Packagist.org来了解这一点。尽管作曲家的日志相当(和不必要)冗长,但它只给了我一些提示。它并没有真正指出具体的问题。



Does anyone know of a complete documentation or how to explain the reasoning behind the logs, maybe taking the above ones as an example?

有没有人知道一份完整的文档,或者如何解释日志背后的原因,或者以上面的日志为例?


更多回答
优秀答案推荐

Documentation of Composer can be found at getcomposer.org/doc, especially Troubleshooting section. Usually the dependency problems comes from misconfiguration of your composer.json and understanding Composer logs comes with experience or learning on trial and error. Documenting every possible errors out of hundreds can become quickly outdated. If you believe some specific error isn't clear enough, you can always raise a new suggestion at the Composer's GitHub page.

有关Composer的文档可以在getComposer.org/doc上找到,特别是故障排除部分。通常情况下,依赖问题来自您的Composer.json的错误配置,而理解Composer日志需要经验或不断尝试错误的学习。记录数百个错误中的每一个可能很快就会过时。如果你认为某些特定的错误不够清楚,你可以随时在作曲家的GitHub页面上提出新的建议。


As suggested in linked GitHub issue, "Conclusion: don't install" message it could be related to requirements defined in minimum-stability. Another linked question could be related to Composer's bug as reported at GH-7215.

正如链接的GitHub问题所建议的,“结论:不要安装”消息可能与最低稳定性中定义的要求有关。另一个相关问题可能与GH-7215报告的Composer错误有关。


Errors


Here is a small guide explaining the common Composer's errors:

以下是一个小指南,解释了常见作曲家的错误:





  • Can only install one of: org/package[x.y.z, X.Y.Z].

    只能安装以下之一:org/Package[x.y.z,X.Y.Z]。



    If you see this messages, that could be the main cause of the dependency issue. It basically means that based on the Composer's dependency calculation both of these versions are required, but only one major version can be installed (you cannot have both x.y.z and X.Y.Z, unless you split your configuration for different folders). To see why these packages are required, use the composer why/depends command and adjust the dependencies accordingly.

    如果您看到此消息,这可能是依赖关系问题的主要原因。这基本上意味着,根据Composer的依赖关系计算,这两个版本都是必需的,但只能安装一个主版本(您不能同时拥有x.y.z和X.Y.Z,除非您将配置拆分到不同的文件夹)。要了解为什么需要这些包,请使用Composer的为什么/依赖命令并相应地调整依赖项。


    See: How to resolve a "Can only install one of:" conflict? & How to solve two packages requirements conflicts when running composer install?

    请参阅:如何解决“只能安装其中之一:”冲突?&如何在运行Composer安装时解决两个包的要求冲突?





  • Installation request for org/package2 (locked at vX.Y.Z)

    Org/Package2的安装请求(锁定在vX.Y.Z)



    This message means that there was an installation request for org/package, however, it is locked at X.Y.Z. If the requested version is not compatible with the locked version (like a different major version), you cannot install both. This message often comes along with already mentioned "Can only install one" one. So, whenever you see "locked at", that means Composer reads your installed package version from the composer.lock file. To troubleshoot, you can use composer why/depends command to find why the package was requested and adjust the compatibility, otherwise, you may try to remove composer.lock file and start from scratch (ideally from the empty folder).

    此消息表示存在org/Package的安装请求,但它在X.Y.Z被锁定。如果请求的版本与锁定的版本不兼容(如不同的主版本),则不能同时安装两者。这条消息经常伴随着已经提到的“只能安装一个”一起出现。因此,每当您看到“Locked At”时,这意味着Composer从Composer.lock文件中读取您已安装的包版本。要进行故障排除,您可以使用Composer为什么/依赖命令来查找请求软件包的原因并调整兼容性,否则,您可以尝试删除Composer.lock文件并从头开始(理想情况下从空文件夹开始)。


    See: Installation failed for laravel/lumen-installer: guzzlehttp/guzzle locked at 6.3.0

    请参阅:laravel/Lumen安装失败-installer:guzzlehttp/guiz在6.3.0锁定





  • org/package1 vx.y.z conflicts with org/package2[vX.Y.Z].

    Org/Package1 vx.y.z与org/Package2[vX.Y.Z]冲突。



    It is a similar issue as above where two packages are conflicting and you need to solve the dependency manually. Reading the whole context of the message may give you some more clues. Checking the dependency tree may also help (composer show -t).

    这是一个与上面类似的问题,两个包冲突,您需要手动解决依赖关系。阅读整个信息的上下文可能会给你更多的线索。检查依赖关系树也可能有帮助(Composer show-t)。





  • conflict with your requirements or minimum-stability

    与您的要求或最低稳定性冲突



    This message means as it reads, so you should check the required version and/or your minimum-stability settings.

    此消息的意思是阅读,因此您应该检查所需的版本和/或您的最低稳定性设置。




This can be caused by a package being marked as non-stable and your requirements being "stable only. See: But these conflict with your requirements or minimum-stability

这可能是因为包被标记为非稳定的,而您的要求仅为“稳定”。请参阅:但这些与您的要求或最低稳定性冲突


Or because of conflicts with other installed packages. See: How to identify what is preventing Composer from installing latest version of a package?.

或者因为与其他已安装的程序包冲突。请参阅:如何识别阻止Composer安装最新版本程序包的原因?


For any other errors, check out the official Composer's Troubleshooting page.

对于任何其他错误,请查看官方Composer的故障排除页面。


Troubleshooting


Here are more suggestions how to troubleshoot the Composer dependency issues in general:

以下是更多有关如何解决Composer依赖关系问题的建议:



  • Add -v/-vv/-vvv parameter to your command for more verbose output.

  • Run composer diagnose to check for common errors to help debugging problems.

  • If you seeing "locked at x.y.z" messages, it relates to packages locked in your composer.lock.

  • Test your composer.json on the empty folder.

  • Keep your composer.json to minimum.

  • Run composer show -t to see your current dependency tree.

  • Run composer show -a org/package x.y.z to check the details about the package.

  • Feel free to ask a new question at Stack Overflow.


To fully debug Composer's dependency problem, you can:

要完全调试Composer的依赖关系问题,您可以:





Useful threads explaining common errors:

解释常见错误的有用线索:




Error:



somevendor/somepackage[v1.0.0, ..., v1.9.1] require composer-plugin-api ~[X.X]



This means that that somevendor/somepacakge requires that a specific version range of Composer to be installed.

这意味着某些事件/某些事件包需要安装特定版本范围的Composer。


Run composer -v and compare it to the version constraint in the error message (shown as ~X.X in the example above, but that could be something like ^1.0, or ^2.2, etc).

运行Composer-v并将其与错误消息(在上面的示例中显示为~X.X,但可能类似于^1.0或^2.2等)中的版本约束进行比较。


If your version does not match the constraint, see if you can either:

如果您的版本与约束不匹配,请查看是否可以:



  • upgrade or downgrade your composer version to match the composer constraint in the error message

  • upgrade somevendor/somepackage so that it can work with your Composer version.



Move composer.lock away temporarily and re-run the command. It's likely you will get much more useful errors. Of course: make sure you are under version control so you can revert if things go haywire. But it's worth a try.

移动Composer.Lock暂时离开,然后重新运行该命令。您可能会得到更多有用的错误。当然:请确保您处于版本控制之下,以便在出现问题时可以进行恢复。但这值得一试。


更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com