php 在尝试安装guzzlehttp时,解决这些错误的建议解决方案是什么?

nr9pn0ug  于 2023-02-28  发布在  PHP
关注(0)|答案(1)|浏览(932)

尝试安装guzzlehttp/guzzle时
composer require guzzlehttp/guzzle
我收到以下问题消息

Using version ^7.5 for guzzlehttp/guzzle
./composer.json has been updated 
Running composer update guzzlehttp/guzzle
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 guzzlehttp/guzzle ^7.5 -> satisfiable by guzzlehttp/guzzle[7.5.0, 7.5.x-dev].
    - guzzlehttp/guzzle[7.5.0, ..., 7.5.x-dev] require guzzlehttp/psr7 ^1.9 || ^2.4 -> found guzzlehttp/psr7[dev-master, 1.9.0, 1.x-dev, 2.4.0, ..., 2.4.x-dev (alias of dev-master)] but the package is fixed to 2.1.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                                                                                                                                                           
    - guzzlehttp/guzzle[7.5.0, ..., 7.5.x-dev] require guzzlehttp/psr7 ^1.9 || ^2.4 -> found guzzlehttp/psr7[dev-master, 1.9.0, 1.x-dev, 2.4.0, ..., 2.4.x-dev (alias of dev-master)] but the package is fixed to 2.1.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.                                           
    - codeception/module-phpbrowser 1.0.2 requires guzzlehttp/guzzle ^6.3|^7.0 -> satisfiable by guzzlehttp/guzzle[7.5.0, 7.5.x-dev].
    - codeception/module-phpbrowser is locked to version 1.0.2 and an update of this package was not requested.                                                       

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require guzzlehttp/guzzle:*" to figure out if any version is installable, or "composer require guzzlehttp/guzzle:^2.1" if you know which you need.

我需要使用稳定版本的guzle。
我已经读到了这个问题,建议删除composer.lock文件,以便运行composer installcomposer update。但我想知道在这种情况下,建议的解决方案是什么?

6kkfgxo0

6kkfgxo01#

我认为根composer.json文件要求的guzzlehttp/guzzle版本和codecrement/module-phpbrowser要求的版本有冲突,composer.json文件要求guzzlehttp/guzzle ^7.5,只有7.5.0和7.5.x-dev版本才能满足,而codecrement/module-phpbrowser要求guzzlehttp/guzzle ^6.3|^7.0,这是只有版本7.5.0和7.5.x-dev才能满足的。试试这个composer update -w,这将更新所有的包和它们的依赖项,包括那些在composer.lock文件中锁定到特定版本的包。我希望这个能有所帮助。(PS:在你尝试任何事情之前备份你的文件,比如原始的json文件)

相关问题