我正在使用 Laravel 5.8,我想安裝 GuzzleHttp 套件。
首先我嘗試執行 composer require guzzlehttp/guzzle
,但出現此錯誤:
Problem 1 - guzzlehttp/guzzle[7.4.0, ..., 7.4.x-dev] require guzzlehttp/promises ^1.5 -> found guzzlehttp/promises[dev-master, 1.5.0, 1.5.1, 1.5.x-dev (alias of dev-master)] but the package is fixed to 1.4.1 (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 guzzlehttp/guzzle ^7.4 -> satisfiable by guzzlehttp/guzzle[7.4.0, ..., 7.4.x-dev].
然後我嘗試安裝降級版本,因此我執行以下命令:
composer require "guzzlehttp/guzzle:~5.3"
但出現此錯誤:
Problem 1 - Root composer.json requires guzzlehttp/guzzle ~5.3, found guzzlehttp/guzzle[5.3.0, ..., 5.3.x-dev] but these were not loaded, likely because it conflicts with another require. Problem 2 - anhskohbo/no-captcha is locked to version 3.3.0 and an update of this package was not requested. - anhskohbo/no-captcha 3.3.0 requires guzzlehttp/guzzle ^6.2|^7.0 -> found guzzlehttp/guzzle[dev-master, 6.2.0, ..., 6.5.x-dev, 7.0.0-beta. 1, ..., 7.4.x-dev (alias of dev-master)] but it conflicts with your root composer.json require (~5.3). Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
那麼這裡出了什麼問題呢?如何正確安裝 Laravel 5.8 版本的 GuzzleHttp?
嘗試在指令中加入
-w
標誌:作曲家需要 guzzlehttp/guzzle -w
#您的其他依賴項之一需要
guzzlehttp/promises
,目前在您的composer.lock
中鎖定為1.4.1
#-w
標誌告訴 Composer 在安裝新依賴項時可以更新依賴項。如果這不起作用,那麼您可以嘗試使用
-W
標誌。