执行composer install遇到错误:Your requirements could not be resolved to an installable set of packages. 这是因为不匹配composer.json要求的版本,错误代码如下。
Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for doctrine/annotations v1.6.0 -> satisfiable by doc trine/annotations[v1.6.0]. - doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (7.0.12) does not satisfy that requirement. Problem 2 - Installation request for doctrine/cache v1.7.1 -> satisfiable by doctrine/ cache[v1.7.1]. - doctrine/cache v1.7.1 requires php ~7.1 -> your PHP version (7.0.12) does not satisfy that requirement. Problem 3 - Installation request for doctrine/collections v1.5.0 -> satisfiable by doc trine/collections[v1.5.0]. - doctrine/collections v1.5.0 requires php ^7.1 -> your PHP version (7.0.12) does not satisfy that requirement. Problem 4 - Installation request for doctrine/common v2.8.1 -> satisfiable by doctrine /common[v2.8.1]. - doctrine/common v2.8.1 requires php ~7.1 -> your PHP version (7.0.12) does not satisfy that requirement. Problem 5 - Installation request for doctrine/dbal v2.7.1 -> satisfiable by doctrine/d bal[v2.7.1]. - doctrine/dbal v2.7.1 requires php ^7.1 -> your PHP version (7.0.12) does n ot satisfy that requirement. Problem 6 - Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctr ine/inflector[v1.3.0]. - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.12) d oes not satisfy that requirement. Problem 7 - Installation request for symfony/css-selector v4.1.0 -> satisfiable by sym fony/css-selector[v4.1.0]. - symfony/css-selector v4.1.0 requires php ^7.1.3 -> your PHP version (7.0.1 2) does not satisfy that requirement. Problem 8 - Installation request for symfony/event-dispatcher v4.1.0 -> satisfiable by symfony/event-dispatcher[v4.1.0]. - symfony/event-dispatcher v4.1.0 requires php ^7.1.3 -> your PHP version (7 .0.12) does not satisfy that requirement. Problem 9 - Installation request for symfony/translation v4.1.0 -> satisfiable by symf ony/translation[v4.1.0]. - symfony/translation v4.1.0 requires php ^7.1.3 -> your PHP version (7.0.12 ) does not satisfy that requirement. Problem 10 - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doc trine/instantiator[1.1.0]. - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.12) does not satisfy that requirement. Problem 11 - Installation request for myclabs/deep-copy 1.8.1 -> satisfiable by myclabs /deep-copy[1.8.1]. - myclabs/deep-copy 1.8.1 requires php ^7.1 -> your PHP version (7.0.12) doe s not satisfy that requirement. Problem 12 - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.12) d oes not satisfy that requirement. - laravel/framework v5.5.40 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0]. - Installation request for laravel/framework v5.5.40 -> satisfiable by larav el/framework[v5.5.40].
查看了下资料说是php版本不符,打开composer.json发现代码只要求大于7.0.0可仍然报这个错误,不用太较真执行如下代码之后在运行之前的代码就ok
composer install --ignore-platform-reqs 或者 composer update --ignore-platform-reqs