Composer Update failed — out of memory

后端 未结 25 2418
再見小時候
再見小時候 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:15
    php -d memory_limit=-1 /usr/local/bin/composer update --no-scripts
    

    memory_limit=-1 is for unlimited memory for this process when you add php before the composer for unlimited memory then you have to give composer complete path where its installed on server (for ubntu) its /usr/local/bin/composer Reamining part is just compoer commands update/install

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

    Rather than permanently setting your memory limit to an increased number (or unlimited), I use this;

    # Running an update
    COMPOSER_MEMORY_LIMIT=-1 composer update
    
    COMPOSER_MEMORY_LIMIT=-1 composer require PACKAGE/NAME
    

    That temporarily set's the composer memory limit env variable to unlimited.

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

    The solution that works both on local environment but also in a container (e.g. in a build stage of a pipeline) where composer might be installed in tricky way, is

    COMPOSER_MEMORY_LIMIT=-1 composer install
    
    0 讨论(0)
  • 2020-12-01 01:19

    sudo php -d memory_limit=-1 bin/magento setup:di:compile

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

    Solved by deleting the whole vendor folder, and then doing the composer update again, and it works... somehow. I don't even understand :v

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

    If on Windows, using XAMP, I recommend to Update your Composer version to latest. Uninstall, download latest - https://getcomposer.org/download/ and install.

    Could also try update PHP version to latest.

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