Composer安装说在生产环境中出现以下错误

时间:2017-12-28 07:02:05

标签: php composer-php

当我尝试在prod中安装composer时,我在安装composer时出现以下错误,任何人都可以建议我帮忙。谢谢。

 Problem 1
- Installation request for doctrine/annotations v1.5.0 -> satisfiable by doctrine/annotations[v1.5.0].
- doctrine/annotations v1.5.0 requires php ^7.1 -> your PHP version (7.0.22) 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.22) does not satisfy that requirement.
 Problem 3
- Installation request for doctrine/collections v1.5.0 -> satisfiable by doctrine/collections[v1.5.0].
- doctrine/collections v1.5.0 requires php ^7.1 -> your PHP version (7.0.22) 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.22) does not satisfy that requirement.
 Problem 5
- Installation request for doctrine/dbal v2.6.2 -> satisfiable by doctrine/dbal[v2.6.2].
- doctrine/dbal v2.6.2 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
Problem 6
- Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
 Problem 7
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- phpunit/phpunit-mock-objects 3.4.4 requires doctrine/instantiator ^1.0.2 -> satisfiable by doctrine/instantiator[1.1.0].
- Installation request for phpunit/phpunit-mock-objects 3.4.4 -> satisfiable by phpunit/phpunit-mock-objects[3.4.4].

2 个答案:

答案 0 :(得分:0)

你的composer.lock是在运行PHP7.1的计算机上制作的,但是你的prod服务器运行的是7.0.22,或者你对(我猜)教条的版本限制太高了。 要绕过第一个,请将其添加到composer.json中: ... "config": { "platform": { "php": "7.0.22" } } ... ,运行composer update并检入生成的composer.lock文件。通过这种方式,您可以强制编写器为您的生产php版本选择包,该版本应该与您的开发版本(7.1)兼容。

答案 1 :(得分:0)

它比编辑composer.json更简单的解决方案

使用带有composer命令的开关--ignore-platform-reqs 例如

composer update --ignore-platform-reqs