我运行composer install
我收到此错误,告诉我使用composer update
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
Problem 2
- Installation request for symfony/css-selector v4.0.3 -> satisfiable by symfony/css-selector[v4.0.3].
- symfony/css-selector v4.0.3 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
Problem 3
- Installation request for symfony/event-dispatcher v4.0.3 -> satisfiable by symfony/event-dispatcher[v4.0.3].
- symfony/event-dispatcher v4.0.3 requires php ^7.1.3 -> your PHP version (7.0.25) does not satisfy that requirement.
Problem 4
- 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.25) does not satisfy that requirement.
Problem 5
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
- laravel/framework v5.5.32 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
- Installation request for laravel/framework v5.5.32 -> satisfiable by laravel/framework[v5.5.32].
我跑composer update
,我得到了这个
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/dbal v2.6.3 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
- doctrine/dbal v2.6.2 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
- doctrine/dbal v2.6.1 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
- doctrine/dbal v2.6.0 requires php ^7.1 -> your PHP version (7.0.25) does not satisfy that requirement.
- Installation request for doctrine/dbal ^2.6 -> satisfiable by doctrine/dbal[v2.6.0, v2.6.1, v2.6.2, v2.6.3].
现在该怎么办?
这就是我在composer.json
cat composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"anouar/paypalpayment": ">=3.0",
"doctrine/dbal": "^2.6",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"spatie/laravel-newsletter": "^4.1",
"srmklive/paypal": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
},
"files": ["app/Http/Helper.php"]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
答案 0 :(得分:1)
前几天我遇到了同样的问题我修复了伪造我的composer.json文件中的php版本。
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"platform" : {
"php": "7.1"
}
}
有关详细信息,请参阅this
或者您可以使用--ignore-platform-reqs标志执行composer update / install命令,如下所示
作曲家更新--ignore-platform-reqs