composer selfupdate
Unable to run 'composer update' or 'composer install' command
Hi
I recently download xampp for windows. After installing xampp I shifted all my project to htdocs folder. while running project I am getting this error
Declaration of Doctrine\DBAL\Driver\PDOConnection::query() must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs)
After some research I came to know I should update my composer.json to latest version. I tried running
composer install
composer update
after running this I am getting error like this
Problem 1
- Root composer.json requires php ^7.2.5 but your php version (8.0.2) does not satisfy that requirement.
Problem 2
- asm89/stack-cors is locked to version v2.0.1 and an update of this package was not requested.
- asm89/stack-cors v2.0.1 requires php ^7.0 -> your php version (8.0.2) does not satisfy that requirement.
Problem 3
- doctrine/dbal is locked to version 2.10.2 and an update of this package was not requested.
- doctrine/dbal 2.10.2 requires php ^7.2 -> your php version (8.0.2) does not satisfy that requirement.
Problem 4
- dragonmantank/cron-expression is locked to version v2.3.0 and an update of this package was not requested.
- dragonmantank/cron-expression v2.3.0 requires php ^7.0 -> your php version (8.0.2) does not satisfy that requirement.
Problem 5
- laravel/framework is locked to version v7.24.0 and an update of this package was not requested.
- laravel/framework v7.24.0 requires php ^7.2.5 -> your php version (8.0.2) does not satisfy that requirement.
like this I am getting 50 errors related to all packages different versions. I tried everything but unable to do. my composer.json
"require": {
"php": "^7.2.5",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.22.2",
"laravel/tinker": "^2.0",
"laravel/ui": "2.0",
"laravelcollective/html": "^6.1",
"livewire/livewire": "^2.2",
"spatie/laravel-medialibrary": "^8.0.0",
"spatie/laravel-permission": "^3.13",
"tymon/jwt-auth": "^1.0",
"yajra/laravel-datatables": "1.5"
},
"require-dev": {
"facade/ignition": "^2.0",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
please help to solve this problem.
thank you
Usually problems like that are dependency related, you have to (even if manually) check dependencies.
I normally always run:
composer clearcache
composer selfupdate
If still having problems:
Backup the lock file. Delete the lock file. Try again.
If that doesn't work you have a mismatched dependency, you need to check the various GitHub repositories and track down your mismatched dependency.
Just an extreme example:
Laravel 4.1 would not match with the framework 8.0.
So you need to go to the various composer.json files and make sure the dependencies are correct.
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4", here here
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
},
Pretend in the above your composer.json had "fideloper/proxy": "^3.0", so you would need to fix that.
That was just another example.
Please or to participate in this conversation.