I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install
but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update
on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With