【发布时间】:2021-10-16 12:49:32
【问题描述】:
在我的开发机器上,我有 PHP 8,我正在尝试让 Composer 升级一些包,但是尽管所有包都有支持 PHP 8 的更新,但它仍然会给出关于 PHP 版本的错误。
我不知道如何解决这个问题?
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 abraham/twitteroauth ^1.2 -> satisfiable by abraham/twitteroauth[1.2.0].
- abraham/twitteroauth 1.2.0 requires php ^7.2 || ^7.3 || ^7.4 -> your php version (8.0.9) does not satisfy that requirement.
Problem 2
- guzzlehttp/guzzle 7.0.1 requires php ^7.2.5 -> your php version (8.0.9) does not satisfy that requirement.
- google/apiclient v2.7.2 requires guzzlehttp/guzzle ~5.3.1||~6.0||~7.0 -> satisfiable by guzzlehttp/guzzle[7.0.1].
- google/apiclient is locked to version v2.7.2 and an update of this package was not requested.
尝试强制更新我想要的版本,但仍然无法正常工作:
composer update abraham/twitteroauth:3.0.0
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 abraham/twitteroauth ^1.2, 3.0.0, found abraham/twitteroauth[dev-dependabot/npm_and_yarn/concurrently-6.2.1, dev-dependabot/npm_and_yarn/path-parse-1.0.7, dev-dependabot/npm_and_yarn/prettier/plugin-php-0.17.3, dev-dependabot/composer/phpmd/phpmd-2.10.2, dev-dependabot/composer/phpunit/phpunit-9.5.8, dev-main, dev-master, dev-subdomains, 0.2.1, ..., 0.9.2, 1.0.0, ..., v1.x-dev, 2.0.0, 2.0.1, 2.0.2, 3.0.0, 3.1.0] but it does not match the constraint.
【问题讨论】:
-
它在消息中,abraham/twitteroauth 1.2.0 需要 php ^7.2 || ^7.3 || ^7.4 -> 您的 php 版本 (8.0.9) 不满足该要求。
-
我发现错误很清楚。您尝试使用的包不支持 PHP 8,因此解决方案是查找支持的包(或升级到这些包的版本)
-
您尝试使用的@NaughtySquid 1.2 版不支持 PHP 8 它在packagist.org/packages/abraham/twitteroauth#1.2.0 中明确说明
-
根 composer.json 需要 abraham/twitteroauth ^1.2,它不会试图强制一个新的东西。
-
composer update不会自动更新您的composer.json,它只会更新composer.lock。它将拒绝强制使用不符合您的composer.json的版本,以防止您意外安装可能会破坏您的代码的主要版本。您需要使用composer require abraham/twitteroauth:^2.0或手动编辑您的composer.json才能实际更改文件。
标签: php composer-php