Composer require Fatal error: Allowed memory size of 1610612736 bytes exhausted
Suppose you run composer update or composer require like:
composer require laravel/framework
and see such fatal error:
If you encounter such issue after running composer require, you don’t have to touch or update the PHP INI file.
How to solve Composer error about running out of memory?
The solution is to run only this:
COMPOSER_MEMORY_LIMIT=-1 composer require Vendor/PackageName
COMPOSER_MEMORY_LIMIT=-1 composer require laravel/frameworkorCOMPOSER_MEMORY_LIMIT=-1 composer update
Reason of this error:
This is because of the fact in
composer.json file most of the packages has a version like
6.* and this causes to load much memory. If you want to correct such error fundamentally, you should refer to them more specifically like