Dirty secret of using composer is that there is an open on-going big bug. There will be instances where doing "composer update -vvv" or "composer require x/y -vvv" will get you exception errors. proc_open fails because of lack of memory.

Google : composer + proc_open(): fork failed

Composer update runs out of memory
https://github.com/composer/composer/issues/1898

Composer maintainers admit that there needs to be a better way and in the meantime up your memory during composer updates and requires. Thus, we need an alternative way of installing "address" module and its libraries without going through composer.

Anyone out there knows how to install "address" module and satisfy the vendor libraries requirements?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chriscalip created an issue. See original summary.

chriscalip’s picture

Issue summary: View changes
chriscalip’s picture

Fixing the installation problem for d8 address module, ie. composer fails in installing commerceguys libraries, zone and addressing.
The crux of the problem is the architecture of composer is currently having scaling pains. The more packagist.org modules are in play the more
apparent the scale pains.

address/README.MD
Installation
-------------
This module needs to be installed via Composer, which will download the required libraries.
1. Add the Drupal Packagist repository
```sh
composer config repositories.drupal composer https://packagist.drupal-composer.org
```
This allows Composer to find Address and the other Drupal modules.
2. Download Address

   composer require "drupal/address ~8.1"
  

This will download the latest release of Address.
Use 8.1.x-dev instead of ~8.1 to get the -dev release instead.

At times this fails during

   composer require "drupal/address ~8.1"
  

The long term solution is finally fixing the scaling pains of composer architecture.
The workaround solution is to provide more memory during this composer command execution.

Idea :

   php -d memory_limit=-1 [composer-file] require "drupal/address ~8.1" -vvv
  

Concrete Examples
a.)

   php -d memory_limit=-1 /usr/local/bin/composer require "drupal/address ~8.1" -vvv
  

b.)

   php -d memory_limit=-1 /usr/local/bin/composer.phar require "drupal/address ~8.1" -vvv
  

The -vvv is the verbose flag to see what is the specific reason for failure.
The php -d memory_limit=-1 gives composer command execution unlimited resources.

Another workaround is to add directory to /DRUPAL_ROOT/vendor library the necessary libraries and then manually edit composer.lock to declare library availability.

chriscalip’s picture

Title: Provide alternative way to install when composer fails. » README.MD Add troubleshooting when composer fails.
chriscalip’s picture

bojanz’s picture

Another workaround is to add directory to /DRUPAL_ROOT/vendor library the necessary libraries and then manually edit composer.lock to declare library availability.

No, that doesn't work. You'd also need to edit the vendor/composer/installed.json file, and regenerate the autoloader, at minimum.
composer.lock is not actually used at runtime (outside of composer install).

Keep in mind that most memory limits around local Composer are due to the VM itself, you can set an unlimited memory limit, but that doesn't mean the VM has access to any significant memory. Same how you can set 512M as the Drupal memory limit but have the script only get 60M cause that's how much the system has left.

I agree that we need a good troubleshooting page, but it needs to live on drupal.org (on a dedicated page under the existing Composer docs), that way people can expand it without patching README all the time.

chriscalip’s picture

Indeed, I've updated the community documentation page on composer.
Using Composer in a Drupal project
https://www.drupal.org/node/2404989

Right, on the memory issue also seen on how to-do page swaps for memory??.. its on the github issue queue.

Also thanks for the info on how to manually add a vendor library. It's useful to know of an override.i

chriscalip’s picture

Status: Active » Closed (won't fix)