根composer.json需要php^7.3但您的php版本(8.0.0)不满足该要求

运行composer install命令时出现异常错误。它需要 PHP 7.3,而我有 PHP 8.0.0。这个问题与Composer 中的 Override PHP base dependency不同,因为我的 PHP (8.0.0) 版本高于它所需的版本,只是想知道为什么它不起作用?

Problem 1
    - Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement.         Problem 2
    - asm89/stack-cors is locked to version v2.0.1 and an update of this package was not requested.
    - asm89/stack-cors v2.0.1 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.   Problem 3
    - laravel/framework is locked to version v8.10.0 and an update of this package was not requested.
    - laravel/framework v8.10.0 requires php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.   Problem 4
    - laravel/tinker is locked to version v2.4.2 and an update of this package was not requested.
    - laravel/tinker v2.4.2 requires php ^7.2 -> your php version (8.0.0) does not satisfy that requirement.   Problem 5
    - facade/flare-client-php is locked to version 1.3.6 and an update of this package was not requested.
    - facade/flare-client-php 1.3.6 requires php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.   Problem 6
    - facade/ignition is locked to version 2.4.1 and an update of this package was not requested.
    - facade/ignition 2.4.1 requires php ^7.2.5 -> your php version (8.0.0) does not satisfy that requirement.   Problem 7
    - fzaninotto/faker is locked to version v1.9.1 and an update of this package was not requested.
    - fzaninotto/faker v1.9.1 requires php ^5.3.3 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.   Problem 8
    - nunomaduro/collision is locked to version v5.0.2 and an update of this package was not requested.
    - nunomaduro/collision v5.0.2 requires php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.   Problem 9
    - asm89/stack-cors v2.0.1 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - fruitcake/laravel-cors v2.0.2 requires asm89/stack-cors ^2.0.1 -> satisfiable by asm89/stack-cors[v2.0.1].
    - fruitcake/laravel-cors is locked to version v2.0.2 and an update of this package was not requested.

回答

这是因为在您的 composer.json 文件中的项目中,您拥有:

"require": {
    "php": ">=7.3",
    .....
},

尝试将此要求更新为:

"require": {
    "php": "^7.3|^8.0",
    .....
},

试试这个它的工作原理

  1. https://www.devopsschool.com/blog/how-to-downgrade-php-from-8-0-0-to-7-1-32-in-xampp-8-0-0/
  • `composer install --ignore-platform-reqs`
  • the double pipe should be used instead of the single one. the single one still works, but just for posterity: https://github.com/composer/composer/issues/6755
  • @Bira,像魔术一样工作。哈哈

以上是根composer.json需要php^7.3但您的php版本(8.0.0)不满足该要求的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>