【问题标题】:Error "Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement" [duplicate]错误“根 composer.json 需要 php ^7.3 但您的 php 版本 (8.0.0) 不满足该要求” [重复]
【发布时间】:2021-04-03 20:31:49
【问题描述】:

运行composer install 命令时出现异常错误。

它需要 PHP 7.3 而我有 PHP 8.0.0。这个问题与 Override PHP base dependency in composer 不同,因为我的 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.

【问题讨论】:

  • stackoverflow.com/questions/32838881/… 我的问题与此不同,因为我的版本比要求的高。
  • 是的,但您也可以模拟那里的答案中提到的平台。
  • ^7.3 表示版本 7.3.0 或更高版本。但是,它与版本 8 或更高版本不兼容
  • 视情况而定。你通过码头工作吗?这意味着您的容器具有所需的 php 版本。如果您在更新之外尝试并且您的操作系统的 php 版本更高,那么您将收到此警告。解决此问题的一种方法是使用 --ignore-platform-reqs 标志运行 composer update。
  • 'composer install --ignore-platform-reqs' 你也可以使用。它可能适用于你的情况。

标签: php laravel


【解决方案1】:

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

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

尝试将此要求更新为:

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

【讨论】:

  • 应该使用双管而不是单管。唯一的仍然有效,但只是为了后代:github.com/composer/composer/issues/6755
  • composer install --ignore-platform-reqs
  • @Bira 你刚刚救了我的命
  • @Bira,像魔术一样工作。哈哈
  • @Bira,您的解决方案是唯一的
猜你喜欢
  • 2019-08-08
  • 2022-08-10
  • 2021-10-01
  • 2021-05-27
  • 2019-11-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-28
相关资源
最近更新 更多