克隆 Laravel 项目但不能 运行

Clone a Laravel project but can't run

克隆项目和 运行 命令 composer install 后,它显示了这些错误。

Your lock file does not contain a compatible set of packages. Please run composer update.

Problem 1 - cache/adapter-common is locked to version 0.4.0 and an update of this package was not requested. - cache/adapter-common 0.4.0 requires php ^5.6 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
Problem 2 - cache/filesystem-adapter is locked to version 0.4.0 and an update of this package was not requested. - cache/filesystem-adapter 0.4.0 requires php ^5.6 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
Problem 3 - cache/tag-interop is locked to version 1.0.0 and an update of this package was not requested. - cache/tag-interop 1.0.0 requires php ^5.5 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.

当我根据 Laravel 文档更新 .env 文件时 https://laravel.com/docs/8.x/upgrade#php-7.3.0-required 然后 运行 命令 composer update 它再次显示错误

Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires php 7.3.0. but your php version (8.0.0) does not satisfy that requirement.
Problem 2 - Root composer.json requires cache/filesystem-adapter ^0.4.0 -> satisfiable by cache/filesystem-adapter[0.4.0]. - cache/filesystem-adapter 0.4.0 requires php ^5.6 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
Problem 3 - Root composer.json requires doctrine/dbal 2.9.2 -> satisfiable by doctrine/dbal[v2.9.2]. - doctrine/dbal v2.9.2 requires php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.
Problem 4 - laravel/passport[v7.2.0, ..., v7.5.1] require guzzlehttp/guzzle ~6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.5] but it conflicts with your root composer.json require (^7.0.1). - Root composer.json requires laravel/passport ^7.2 -> satisfiable by laravel/passport[v7.2.0, ..., v7.5.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

如何更新另一个 composer.json 也请帮助我。

解决此类相同问题只需升级或降级 PHP 版本即可。只需执行以下步骤。

  • 克隆项目
  • 访问php.net
  • 根据要求安装版本
  • 设置PHP的路径:转到属性->高级系统设置->环境变量->路径