Composer Update failed — out of memory

后端 未结 25 2559
再見小時候
再見小時候 2020-12-01 00:40

I got this error when running composer.phar update on my VM:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried t

相关标签:
25条回答
  • 2020-12-01 01:09

    When using the software Laragon on Windows, the following line helped me requiring a new package without getting the memory error:

    php -d memory_limit=-1 "C:\laragon\bin\composer\composer.phar" require <insert package author here>/<insert package name here>
    
    0 讨论(0)
  • 2020-12-01 01:10

    The only thing that solve my problem was doing this:

    /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
    /sbin/mkswap /var/swap.1
    /sbin/swapon /var/swap.1
    

    REF: COMPOSER TROUBLESHOOTING

    0 讨论(0)
  • 2020-12-01 01:10

    I set memory_limit=-1 in my php.ini file but didnt work but i went ahead to execute commands from link below and then run composer install and worked perfectly

    https://tecadmin.net/enable-swap-on-ubuntu/

    0 讨论(0)
  • 2020-12-01 01:11

    this solution will fix your problem.

    Update your php.ini file then restart Apache or your server example: memory_limit=128M to memory_limit=1128M

    It's work on me.

    0 讨论(0)
  • 2020-12-01 01:12

    Check the Composer's troubleshooting wiki, especially the memory limit errors section.

    For instance, by running the composer like this:

    php -d memory_limit=-1 `which composer` update
    

    I get no error anymore. So it is probably an insufficient memory issue that can be solved inline, without altering your default PHP configuration.

    What the command above does is that it sets the PHP CLI memory limit to "unlimited" (ie. -1) and then it runs the inline composer update command.

    Please note that instead of `which composer` you should probably use the real path of your composer.phar PHP script. The which composer written inline (like in my example above) will be inline solved to your composer.phar full path (you may use whatever form you like).

    0 讨论(0)
  • 2020-12-01 01:13

    You may also get resolved by just removing vendor directory and re-execute composer install command.

    0 讨论(0)
提交回复
热议问题