简体   繁体   中英

How to resolve Laravel Composer Issue - Your requirements could not be resolved to an installable set of packages

I am using the Windows Operation system to run PHP Laravel-8 Application. The PHP version for all the projects in my Windows Local System is PHP-Version3.8. All the Laravel Projects in my Local System has ("php": "^7.3|^8.0",)

However, I did a pull request from a Team Project but it is PHP-Version4. The Project also uses Laravel-8 Framework ("php": "^7.4|^8.0",)

When I tried to run composer install on the downloaded project, I got this error:

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

Problem 1
  - Root composer.json requires php ^7.4|^8.0 but your PHP version (7.3.8) does not satisfy that requirement.
  Problem 2
  - lcobucci/clock is locked to version 2.0.0 and an update of this package was not requested.
  - lcobucci/clock 2.0.0 requires php ^7.4 || ^8.0 -> your php version (7.3.8) does not satisfy that requirement.
Problem 3
  - lcobucci/jwt is locked to version 4.0.3 and an update of this package was not requested.
  - lcobucci/jwt 4.0.3 requires php ^7.4 || ^8.0 -> your php version (7.3.8) does not satisfy that requirement.
Problem 4
  - lcobucci/jwt 4.0.3 requires php ^7.4 || ^8.0 -> your php version (7.3.8) does not satisfy that requirement.
  - league/oauth2-server 8.2.4 requires lcobucci/jwt ^3.4 || ^4.0 -> satisfiable by lcobucci/jwt[4.0.3].
  - league/oauth2-server is locked to version 8.2.4 and an update of this package was not requested.

Then when I did composer update, the error is just this:

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

Problem 1
 - Root composer.json requires php ^7.4|^8.0 but your php version (7.3.8) does not satisfy that requirement.

All the Projects are using composer-2

If I upgrade my Local system to PHPV-7.4, I will have issues with deployed projects.

How do II get this resolved?

Thanks

Open your composer.json file and replace the version to:

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

You can also use this command:

composer install --ignore-platform-reqs

EDIT:

If that didn't work or results more issues, I will suggest you updating the PHP version, then you have to specify the PHP version for the older projects and tie them to use the PHP 7.3 to avoid any issue. Add these lines in the composer.json file for every old project you have after updating PHP:

"config": {

  "platform": {

    "php": "7.3"

  }

},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM