LoginSignup
45
32

More than 3 years have passed since last update.

composer requireで"Allowed memory size of 1610612736 bytes exhausted"エラーが出た場合の対処法

Last updated at Posted at 2020-08-03

問題

ローカル環境でパッケージをインストールしようとして、composer requireをした際に、以下のようなエラーが出ました。

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)

対処法

根本解決するには、何やらメモリ割当?などの設定を弄らないと駄目な感じですが、とりあえず以下のコマンドで対処療法できました。

$ COMPOSER_MEMORY_LIMIT=-1 composer require xxxx/xxxx

※xxxx/xxxxの部分は、インストールするパッケージに合わせて書き換えてください

COMPOSER_MEMORY_LIMIT=-1でメモリの制限を無しにして、composer requireを走らせます。

再度、別のパッケージをインストールした際にも同じエラーが出たので、設定を書き換えるわけではなく、あくまでもその場限りでメモリ制限を解除しているのだと思います。

以上、自分用メモ。

45
32
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
45
32