← Posts
How to Bypass Composer's Memory Issue
June 3rd, 2020
Since I reset my laptop a few months back I've been getting memory errors when I try and run Composer commands, like composer update
.
1Loading composer repositories with package information2Updating dependencies (including require-dev)3PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 22345Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 22367Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.%
But today, I've finally found a proper solution to bypass them whenever you run into them.
Instead of running just composer update
, you can run this instead: php -d memory_limit=-1 /usr/local/bin/composer
.
That command will temporally set your local PHP's memory limit to -1
(so basically unlimited) and will use the normal composer binary to run the rest of the command.
Hopefully someone finds this helpful.