(looking through the issue queue, I did not see a similar issue) Trying to follow instructions at: http://docs.drupalcommerce.org/v2/getting-started.html

Getting an error (WSOD) in apache:

Error: Call to a member function getRequiredFields() on null in /Users/rkoberg/Sites/fwi/drupal/modules/contrib/address/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php on line 355, referer: http://www.fwi.dev/admin/commerce/stores

Relevant code:

  protected function addressElements(array $element, array $values) {
    $address_format = $this->addressFormatRepository->get($values['country_code']);
    $required_fields = $address_format->getRequiredFields(); // line 355

Putting in a print_r($values) results in:

Array ( [country_code] => AF [administrative_area] => [locality] => [dependent_locality] => [postal_code] => [sorting_code] => [address_line1] => [address_line2] => [organization] => [recipient] => )

Next I set up an Address format for the U.S (/admin/config/regional/address-formats/manage/US) and a Zone (/admin/config/regional/zones/manage/us), but still gt the same error. Any ideas how to fix?

More info: I initially followed the install instructions at: http://docs.drupalcommerce.org/v2/install.html

This failed at the install step 2 for an existing site: composer drupal-update; giving the terminal error:

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Script Drupal\Core\Composer\Composer::vendorTestCodeCleanup handling the post-package-update event terminated with an exception

  [RuntimeException]                                             
  The directory 'tests' in package 'behat/mink' does not exist.  

After some searches, the consensus seemed to be to install using the source:

$ composer update --prefer-source  behat

This appeared to work, and brought down everything, but installed older versions than the non-source update tried to install (see bottom for terminal output). Next, completed the remaining step (composer dump-autoload;) and proceeded to step 3:

$ drupal module:install commerce_product commerce_order commerce_cart commerce_tax
 Installing module(s) commerce_product, commerce_order, commerce_cart, commerce_tax, commerce, entity, commerce_price, commerce_store, inline_entity_form, profile, state_machine
                               
 [OK] The following module(s) were installed successfully: commerce_product, commerce_order, commerce_cart,             
 commerce_tax, commerce, entity, commerce_price, commerce_store, inline_entity_form, profile, state_machine             
                                                                                            
 // settings:check
             
 The extension mysql is recommended to install.                                                                         
                                                                                                                        
 The configuration date.timezone was missing and overwritten with America/Tijuana.                                      
                                                                                                                        
 // cache:rebuild

 Rebuilding cache(s), wait a moment please.
                                
 [OK] Done clearing cache(s).                                          

Terminal output for:

$ composer update --prefer-source behat
Package "behat" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing symfony/polyfill-mbstring (v1.1.1)
  - Removing symfony/polyfill-apcu (v1.1.1)
  - Removing composer/installers (v1.0.23)
  - Installing composer/installers (v1.0.21)
    Cloning d64e23fce42a4063d63262b19b8e7c0f3b5e4c45

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing wikimedia/composer-merge-plugin (v1.3.1)
  - Installing wikimedia/composer-merge-plugin (v1.3.0)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/class-loader (v2.7.10)
  - Installing symfony/class-loader (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/console (v2.7.10)
  - Installing symfony/console (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/dependency-injection (v2.7.10)
  - Installing symfony/dependency-injection (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/debug (v2.8.3)
  - Installing symfony/debug (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/http-foundation (v2.7.10)
  - Installing symfony/http-foundation (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/event-dispatcher (v2.7.10)
  - Installing symfony/event-dispatcher (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/http-kernel (v2.7.10)
  - Installing symfony/http-kernel (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/routing (v2.7.10)
  - Installing symfony/routing (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/serializer (v2.7.10)
  - Installing symfony/serializer (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/translation (v2.7.10)
  - Installing symfony/translation (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/validator (v2.7.10)
  - Installing symfony/validator (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/process (v2.7.10)
  - Installing symfony/process (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing twig/twig (v1.24.0)
  - Installing twig/twig (v1.23.1)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing doctrine/cache (v1.6.0)
  - Installing doctrine/cache (v1.4.2)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing doctrine/inflector (v1.1.0)
  - Installing doctrine/inflector (v1.0.1)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing doctrine/common (v2.5.3)
  - Installing doctrine/common (v2.5.1)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing zendframework/zend-hydrator (1.1.0)
    Cloning 22652e1661a5a10b3f564cf7824a2206cf5a4a65

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing zendframework/zend-stdlib (3.0.0)
  - Installing zendframework/zend-stdlib (2.7.3)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing zendframework/zend-feed (2.7.0)
  - Installing zendframework/zend-feed (2.5.2)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing egulias/email-validator (1.2.11)
  - Installing egulias/email-validator (1.2.9)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing zendframework/zend-diactoros (1.3.3)
  - Installing zendframework/zend-diactoros (1.1.3)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing composer/semver (1.3.0)
  - Installing composer/semver (1.0.0)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing guzzlehttp/psr7 (1.2.3)
  - Installing guzzlehttp/psr7 (1.2.0)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing guzzlehttp/promises (1.1.0)
  - Installing guzzlehttp/promises (1.0.2)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing guzzlehttp/guzzle (6.1.1)
  - Installing guzzlehttp/guzzle (6.1.0)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/dom-crawler (v3.0.3)
  - Installing symfony/dom-crawler (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/css-selector (v2.7.10)
  - Installing symfony/css-selector (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/browser-kit (v3.0.3)
  - Installing symfony/browser-kit (v2.7.6)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing fabpot/goutte (v3.1.2)
  - Installing fabpot/goutte (v3.1.1)
    Downloading: 100%         

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/intl (dev-master d975da2)
    Cloning d975da224440180cfb97c9db135b53ec3ed52079

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/enum (v1.0)
    Cloning 1d9db2dbeb1a02500e7a14589ae2f9cb402c5c95

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/addressing (dev-master 93ddf17)
    Cloning 93ddf176d7dd851edb0bb05694ed1614c5c67ef8

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/zone (dev-master 1a690b7)
    Cloning 1a690b7366a58cf3778b8ca440813d89a56204d4

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/pricing (dev-master fd1c8e6)
    Cloning fd1c8e67d067c04da50780b90522e650e60bb543

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing commerceguys/tax (dev-master fcc7a9d)
    Cloning fcc7a9d00ffc9f4e3c7e3a1883c61cb683fb7b6b

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
zendframework/zend-hydrator suggests installing zendframework/zend-eventmanager (^2.6.2 || ^3.0, to support aggregate hydrator usage)
zendframework/zend-hydrator suggests installing zendframework/zend-serializer (^2.6.1, to use the SerializableStrategy)
zendframework/zend-hydrator suggests installing zendframework/zend-servicemanager (^2.7.5 || ^3.0.3, to support hydrator plugin manager usage)
zendframework/zend-hydrator suggests installing zendframework/zend-filter (^2.6, to support naming strategy hydrator usage)
commerceguys/addressing suggests installing symfony/form (to generate Symfony address forms)
commerceguys/addressing suggests installing symfony/intl (to use it as the source of country data)
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

At the bottom of the output I see suggestions to install additional "things" like "symfony/form", but not really sure how to do that in this install process, if they are indeed needed.

Comments

RobKoberg created an issue. See original summary.

bojanz’s picture

Category: Bug report » Support request

Welcome to our buggy world :)

The directory 'tests' in package 'behat/mink' does not exist.  

This is a Drupal core bug, to be fixed when #2664274: Combination of --prefer-dist and .gitattributes confuses our vendor test cleanup lands.
The right way to fix the issue is to apply that patch, then rerun "composer drupal-update".

Anyway, looks like your workaround resulted in the libraries getting installed.

The other issue you're seeing is documented in the Address issue queue #2622446: Ensure address formats are always installed but so far nobody has provided enough information to track it down.
It seems that an install crash results in the address formats not being imported (you said you created a US address format, one should have already been present), which
causes the module to crash. I suggest uninstalling and re-installing the Address module (and the Commerce modules).

RobKoberg’s picture

Thank you for the details. I applied the patch (#38 https://www.drupal.org/node/2664274#comment-10954323 ) and ran composer drupal-update, but now get a different error:

$ composer drupal-update
> Drupal\composer_manager\Composer\Command::update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing zendframework/zend-hydrator (1.1.0)
  - Removing composer/installers (v1.0.21)
  - Installing composer/installers (v1.0.23)
    Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Script Drupal\Core\Composer\Composer::vendorTestCodeCleanup handling the post-package-update event terminated with an exception
    
  [ErrorException]        
  Undefined variable: io  

Not sure if this is a commerce specific issue (looks like it is core's) or if I should post this info at that issue?

Next I tried (from #34 in the referenced issue), which resulted in the same error, but with more info (tried both composer update -vv --prefer-dist and composer update -vv --prefer-source with the same io error):

$ composer update -vv --prefer-dist
  [merge-plugin] Loading core/composer.json...
  [merge-plugin] Merging php
  [merge-plugin] Merging symfony/class-loader
  [merge-plugin] Merging symfony/console
  [merge-plugin] Merging symfony/dependency-injection
  [merge-plugin] Merging symfony/event-dispatcher
  [merge-plugin] Merging symfony/http-foundation
  [merge-plugin] Merging symfony/http-kernel
  [merge-plugin] Merging symfony/routing
  [merge-plugin] Merging symfony/serializer
  [merge-plugin] Merging symfony/translation
  [merge-plugin] Merging symfony/validator
  [merge-plugin] Merging symfony/process
  [merge-plugin] Merging symfony/yaml
  [merge-plugin] Merging twig/twig
  [merge-plugin] Merging doctrine/common
  [merge-plugin] Merging doctrine/annotations
  [merge-plugin] Merging guzzlehttp/guzzle
  [merge-plugin] Merging symfony-cmf/routing
  [merge-plugin] Merging easyrdf/easyrdf
  [merge-plugin] Merging zendframework/zend-feed
  [merge-plugin] Merging stack/builder
  [merge-plugin] Merging egulias/email-validator
  [merge-plugin] Merging masterminds/html5
  [merge-plugin] Merging symfony/psr-http-message-bridge
  [merge-plugin] Merging zendframework/zend-diactoros
  [merge-plugin] Merging composer/semver
  [merge-plugin] Merging behat/mink
  [merge-plugin] Merging behat/mink-goutte-driver
  [merge-plugin] Merging jcalderonzumba/gastonjs
  [merge-plugin] Merging jcalderonzumba/mink-phantomjs-driver
  [merge-plugin] Merging mikey179/vfsstream
  [merge-plugin] Merging phpunit/phpunit
  [merge-plugin] Merging symfony/css-selector
  [merge-plugin] Loading modules/contrib/address/composer.json...
  [merge-plugin] Merging commerceguys/intl
  [merge-plugin] Merging commerceguys/addressing
  [merge-plugin] Merging commerceguys/zone
  [merge-plugin] Loading modules/contrib/commerce/composer.json...
  [merge-plugin] Deferring duplicate commerceguys/intl
  [merge-plugin] Merging commerceguys/pricing
  [merge-plugin] Merging commerceguys/tax
  [merge-plugin] Loading modules/contrib/devel/webprofiler/composer.json...
  [merge-plugin] Merging symfony/stopwatch
Loading composer repositories with package information
Updating dependencies (including require-dev)
  [merge-plugin] Adding dependency drupal/commerce requires commerceguys/intl (== 9999999-dev)
Analyzed 6114 packages to resolve dependencies
Analyzed 54210 rules to resolve dependencies
  - Removing composer/installers (v1.0.21)
  - Installing composer/installers (v1.0.23)
    Loading from cache
    Extracting archive

    REASON: Required by root: Install command rule (install composer/installers v1.0.21|install composer/installers 1.0.x-dev|install composer/installers v1.0.21|install composer/installers v1.0.22|install composer/installers v1.0.23)

> post-package-update: Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Script Drupal\Core\Composer\Composer::vendorTestCodeCleanup handling the post-package-update event terminated with an exception

  [ErrorException]        
  Undefined variable: io  
                          
Exception trace:
 () at /Users/rkoberg/Sites/fwi/drupal/core/lib/Drupal/Core/Composer/Composer.php:213
 Composer\Util\ErrorHandler::handle() at /Users/rkoberg/Sites/fwi/drupal/core/lib/Drupal/Core/Composer/Composer.php:213
 Drupal\Core\Composer\Composer::findPackageKey() at /Users/rkoberg/Sites/fwi/drupal/core/lib/Drupal/Core/Composer/Composer.php:158
 Drupal\Core\Composer\Composer::vendorTestCodeCleanup() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:233
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:187
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:114
 Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer/src/Composer/Installer.php:602
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:223
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:173
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:166
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:99
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25
alexpott’s picture

@RobKoberg looking at the stack trace I'm confused... in I apply the patch in #2664274: Combination of --prefer-dist and .gitattributes confuses our vendor test cleanup to HEAD drupal line 213 on Compser.php is if (strtolower($key) === $package_name) { - are you sure the patch is applied correctly and that your Composer.php contains no other changes?

RobKoberg’s picture

Intellij IDEA told me the patch applied successfully. I hadn't touched it otherwise (or any other core files). However, the composer.json shows "drupal/core": "~8.0",. So I am probably using the wrong drupal version for the patch? Apologies: just installed this yesterday to check out commerce in D8 and not very familiar with D8 et al.

bojanz’s picture

Status: Active » Fixed

The core patch was committed, you can now install Commerce on tomorrow's -dev release of Core.

Sorry for the bumps in the road. I'm hoping they were the last ones, as far as Composer is concerned.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.