I got this error when running composer.phar update
on my VM:
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried t
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
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.
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
sudo php -d memory_limit=-1 bin/magento setup:di:compile
Solved by deleting the whole vendor folder, and then doing the composer update again, and it works... somehow. I don't even understand :v
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.