我正在尝试在AWS PHP 7.0实例上部署Laravel应用程序(Elastic Beanstalk,但这并不重要)。
我收到以下错误
+ composer.phar install --no-ansi --no-interaction
Do not run Composer as root/super user! See https://getcomposer.org/root for details
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/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.16) does not satisfy that requirement.
Problem 2
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.16) 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].
(Executor::NonZeroExitStatus)
任何想法如何在PHP 7.0上抑制或解决它?
我的composer.json
{
"name": "myapp",
"description": "My App.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/lumen-framework": "5.4.*",
"vlucas/phpdotenv": "~2.2",
"romanpitak/nginx-config-processor": "^0.2.1",
"symfony/stopwatch": "^3.2",
"comodojo/zip": "^2.1",
"riimu/kit-pathjoin": "1.*",
"aws/aws-sdk-php": "^3.25",
"spatie/url": "dev-master"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~5.0",
"mockery/mockery": "~0.9"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/",
"database/"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
P.S。我没有使用任何单元测试。我试图摆脱“require-dev”软件包并仍然出现同样的错误。
答案 0 :(得分:1)
错误是“composer.lock”存在,当我们在这种情况下运行“composer install”时会发生什么?
是时候再次运行composer安装了。这次,Composer将看到目录中有一个composer.lock文件。相反,为了找到兼容版本的依赖项来完成composer.json文件,它将安装您的composer.lock文件中定义的依赖项的确切版本。(https://laravel-news.com/understanding-the-composer-lock-file)