After installation of the module (via Drupal Console if that matters), I get the following error

Fatal error: Interface 'CommerceGuys\Addressing\Model\AddressFormatInterface' not found in /modules/contrib/address/src/Entity/AddressFormatInterface.php on line 21

Comments

pjcarly created an issue. See original summary.

bojanz’s picture

Did you use Composer Manager to download the libraries?

Looks like the addressing library isn't getting found by the autoloader. However, hook_requirements() usually stops module installation in that case.

pjcarly’s picture

No i did not use composer, installed via drupal console

bojanz’s picture

Somehow Drupal Console allowed you to enable the module even though you didn't install the required libraries.
That's a bug somewhere on their side. Check the module README for install instructions.

hendrik.fuss’s picture

I just tried to install address without fetching dependencies via composer beforehand, and it failed, as should be. However, after I run composer drupal-update, I have the same issue, and I'm getting the exact same PHP error.

The required interface, AddressFormatInterface, is defined in vendor/commerceguys/addressing/src/Model/AddressFormatInterface.php, but apparently Drupal doesn't find it there.

Not sure why. Any ideas how to fix this?

bojanz’s picture

Category: Bug report » Support request
Status: Active » Fixed

See #2632916: module doesnt find libraries. Looks like the solution is to run "composer dump-autoload". I'll add that to the README.

(I've yet to figure out what makes MAMP different to require this. Please post your setup to that issue as well).

Status: Fixed » Closed (fixed)

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

hendrik.fuss’s picture

composer dump-autoload fixed the problem for me, thanks bojanz!

selwynpolit’s picture

I had this error occur when I tried upgrading Drupal from version 8.0.1 to 8.0.6 on a test site that had this module installed. I tried the composer dump-autoload but was still seeing the error so I did the following and it got better.

php modules/contrib/composer_manager/scripts/init.php
composer drupal-update
jduff’s picture

I got this error after upgrading from Drupal 8.1.2 to 8.1.3 and selwynpolit's approach on comment #9 resolved the issue.

Yoran Scholiers’s picture

Like #10 I got the error after upgrading to 8.1.3 from 8.1.2.
Comment #9 fixed it.

Andrej Galuf’s picture

Something else to be careful about:

If you use drush up to update the core, it's likely that composer.json and composer.lock will be replaced. This means the requires are lost and the address cannot find the dependencies. The solution is to "redownload" the Address module (composer require drupal/address ~8.1)

bojanz’s picture

Yep. You should not be using drush up to update core. "composer update drupal/core --with-dependencies" is the one to use.

RKopacz’s picture

Just a note to @bojanz on #13, I tried using this to update a site from 8.1.6 to 8.1.7 and it didn't work. Not sure why, did not receive and error message.

bojanz’s picture

@RKopacz
You received some output. Just because it's not in red doesn't mean it's not relevant :)
You probably used the tarball to install, where the drupal/core line in composer.json needs to be moved from "replace" to "require" before running the command.

StevenWill’s picture

I just had to run the commands from comment #9 when updating to 8.0.7. Will this always have to be done? Is there a way around having to run this every time to update Drupal core? It can take some time to initialize and has overhead to manage.

RKopacz’s picture

@bojanz OK thanks I'll try that. I believe I did the site install with drush, so that might be it. I'll try that next time. Seems like everything is migrating to composer :)

just_like_good_vibes’s picture

i was upgrading too and i tried all of the solutions... none of them work ! i'm very surprised.
indeed i did the upgrade through drush.
i will retry the update with a composer... what a mess !

msypes’s picture

Version: 8.x-1.0-beta2 » 8.x-1.0-beta3
Status: Closed (fixed) » Active

I don't know why this issue has been marked as fixed.
I just tried updating my Drupal core from 8.1.3 to 8.19 with Address8.x-1.0-beta3 in place and still get this same fatal error. No amount of composer updates of drupal/core, drupal/address, with or without dependencies, composer dump-autoloads, requires nor any other variant I've neglected has helped.
I don't know whether this is a core issue or an address issue any more, so I've put my two cents in under both issue queues.

bojanz’s picture

Updating core outside of Composer (composer update drupal/core --with-dependencies) will always break your site.
There's nothing for me to do there.

Core telling you to replace the vendor/ folder when performing manual updates is a bug, that line needs to be removed from all docs.

I think that "composer update drupal/address --with-dependencies" should redownload the removed vendor libraries. If not, you can always do "composer remove drupal/address" then redownload again "composer require drupal/address"

msypes’s picture

FTR, I tried a core update without replacing the vendor folder as well, and still had these issues. I'll add the composer remove drupal/addressthen redownload you mentioned to my panoply.

If it's any help, in the end, a restart of apache cleared everything up.

jnicola’s picture

Just ran into this issue with a project.

Drush up entirely blows away everything from commerce guys in vendor.
composer update drupal/core --with-dependencies returns this error and does not update Drupal at all: Package "drupal/core" listed for update is not installed. Ignoring.
composer dump-autoload changed nothing when run after any of the commands tried above.

bojanz’s picture

@jnicola
See #15

jnicola’s picture

    "require": {
        "composer/installers": "^1.0.21",
        "wikimedia/composer-merge-plugin": "~1.3",
        "drupal/address": "~8.1",
        "drupal/core": "~8.1"
    },
    "replace": {
        "drupal/geofield": "8.*",
        "drupal/pathauto": "8.*",
        "drupal/recaptcha": "8.*"
    },

That I believe is what you detailed to do (move drupal/core to "require". It is unfortunately not working for me. Error is as follows:

Fatal error: Interface 'CommerceGuys\Addressing\Model\AddressFormatInterface' not found in /Users/removed/Projects/icon-001-drupal/docroot/modules/contrib/address/src/Entity/AddressFormatInterface.php on line 16
Drush command terminated abnormally due to an unrecoverable error.                                                                 [error]
Error: Interface 'CommerceGuys\Addressing\Model\AddressFormatInterface' not found in
/Users/removed/Projects/icon-001-drupal/docroot/modules/contrib/address/src/Entity/AddressFormatInterface.php, line 16
bojanz’s picture

The instructions were for allowing core updates.
Try running "composer update drupal/address --with-dependencies" for healing your breakage.

jnicola’s picture

Results of composer update drupal/address --with-dependencies

Dependency "drupal/core" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

1541-mbp:icon removed$ drush cr

Fatal error: Interface 'CommerceGuys\Addressing\Model\AddressFormatInterface' not found in /Users/removed/Projects/icon-001-drupal/docroot/modules/contrib/address/src/Entity/AddressFormatInterface.php on line 16
Drush command terminated abnormally due to an unrecoverable error.
bojanz’s picture

Check that you actually have a single vendor folder in your site root, and that it contains the commerceguys/ folder.
The last time someone reported this error they somehow ended up with two vendor folders on Platform.sh, so the wrong one was used.

I'm on IRC at #drupal-commerce if you need more help.

jnicola’s picture

I only have one vendor folder, there is a commerce guys folder in there that contains addressing.

bojanz’s picture

It's actually weird that "composer update drupal/address --with-dependencies" gives you nothing, considering that neither Address RC1 nor RC2 use the "CommerceGuys\Addressing\Model\AddressFormatInterface" class, beta4 was the last one that did.

Check that you don't have multiple address modules (one in modules/address the second in modules/contrib/address).

qpro’s picture

This works for me:

1) /var/www/drupal/modules/composer_manager/scripts$ php init.php

Composer Manager has been successfully initialized.

Diferent path than that indicated in #9

2) /var/www/drupal$ composer update drupal/address --with-dependencies

Package "drupal/address" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

3) /var/www/drupal$ composer config repositories.drupal composer https://packages.drupal.org/8
var/www/drupal$ composer require "drupal/address"

Using version ^1.0@RC for drupal/address
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing commerceguys/enum (v1.0)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing commerceguys/addressing (v1.0.0-beta1)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing commerceguys/zone (dev-master 36fe2e8)
Cloning 36fe2e8f5a8091bf18417d6d409e363677122a99

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing commerceguys/intl (v0.7.3)
Downloading: 100%

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing drupal/address (1.0.0-rc3)
Downloading: 100%

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
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

4) /var/www/drupal$ composer drupal-update
> Drupal\composer_manager\Composer\Command::update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing google/apiclient (1.1.5)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing phayes/geophp (dev-master 6855624)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing leaflet/leaflet (v0.7.7)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing phpoffice/phpspreadsheet (0.0)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing league/csv (7.2.0)
Downloading: 100%

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing drupal/layout_plugin (8.1.0-alpha23)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing igorw/get-in (v1.0.3)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing egeloen/http-adapter (0.8.0)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing willdurand/geocoder (v3.3.0)
Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
egeloen/http-adapter suggests installing ext-http (Allows you to use the PECL adapter)
egeloen/http-adapter suggests installing guzzle/guzzle (Allows you to use the Guzzle 3 adapter)
egeloen/http-adapter suggests installing kriswallsmith/buzz (Allows you to use the Buzz adapter)
egeloen/http-adapter suggests installing nategood/httpful (Allows you to use the httpful adapter)
egeloen/http-adapter suggests installing zendframework/zendframework1 (Allows you to use the Zend 1 adapter)
egeloen/http-adapter suggests installing zendframework/zend-http (Allows you to use the Zend 2 adapter)
egeloen/http-adapter suggests installing symfony/stopwatch (Allows you to use the stopwatch http adapter and event subscriber)
willdurand/geocoder suggests installing ext-geoip (Enabling the geoip extension allows you to use the MaxMindProvider.)
willdurand/geocoder suggests installing geoip/geoip (If you are going to use the MaxMindBinaryProvider (conflict with geoip extension).)
willdurand/geocoder suggests installing geoip2/geoip2 (If you are going to use the GeoIP2DatabaseProvider.)
willdurand/geocoder suggests installing symfony/stopwatch (If you want to use the TimedGeocoder)
Package egeloen/http-adapter is abandoned, you should avoid using it. Use php-http/httplug instead.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

bojanz’s picture

Status: Active » Fixed

Closing old issue.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

This has not been fixed... after updating to 8.5.1 I get the error

PHP Fatal error: Interface 'CommerceGuys\Addressing\AddressInterface' not found in /Users/brody/Documents/sites/beer/modules/contrib/address/src/AddressInterface.php on line 11

Huelfe’s picture

I have this issue too as #33 described.

Murz’s picture

Got same issue on Drupal 8.5.1 when installing Commerce module with dependencies.

barrypoore’s picture

I'm having this same issue, I have updated with composer on my local mamp version and it appears fine, once I push to Acquia I get that same error:

Fatal error: Interface 'CommerceGuys\Addressing\AddressInterface' not found in /xxx/xxx/html/xxxxxxxxx/docroot/modules/contrib/address/src/AddressInterface.php on line 11 .....

I imported my local database with the working version into Acquia but still get the same error.

I have run composer update drupal/core --with-dependencies and it appears to have run although I can't see any library it may have downloaded and installed and git doesn't show any additional library.

Is there any way to manually check if the library is in place? Or the fact that it runs fine in local means the library is in place?

jahanaraS’s picture

composer require "drupal/address ~1.0" worked for me

Christophe Bourgois’s picture

composer require "drupal/address ~1.0" worked for me also

etron770’s picture

composer require "drupal/address ~1.0" worked for me also

Tart0’s picture

Using Docker environments, I have to remove dependency from /modules/address/composer.json and add it to /composer.json.

Then, composer update --ignore-platform-reqs (I'm using docker, so the main system does not fullfy requirements) and it's works like a charm.

Hope it's help

JimWho’s picture

Drupal noob here who doesn't understand half of what everyone else wrote. My scenario came when I updated the email address on a comment form using the Gaviad Edmix template. I clicked save and the whole site crashed and became unresponsive. The commerceguys lib version I had updated to was 1.4.2 after installing the core. I simply copied back the 1.4.0 files that were deleted with the upgrade and the server came back to life. If I did commerce on this site, I'm sure I'd be asking for problems later with the mismatch, but I don't, so I'm going to leave it be.