Fatal error: Allowed memory size of 1610612736 bytes exhausted の対応方法

はじめに

composer update を実行すると、下記のようなエラーが発生した。

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///home/xxxxx/xxxx/xxxxxx/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

本記事では、上記エラーが発生した場合の対応方法について記載する。

 

memoly_limitの変更

私の場合は、下記のように対応することで回避しました。

php -d memory_limit=-1 /usr/local/bin/composer require xxxxxxx/xxxxxxx

ちなみに、下記コマンドでも同様の処理となります

$ COMPOSER_MEMORY_LIMIT=-1 composer require xxxxxxx/xxxxxxx

※ xxxxxxx/xxxxxxx インストールするパッケージとなります。

memory limitを-1にすることでメモリの制限を「なし」にすることができます。

php.iniを編集することでも回避できますが、インストールの時のみの対応なので、一時的に解除してあげれば良いかと思います。

タイトルとURLをコピーしました