Problem/Motivation

When trying to follow the instructions to install the D2 binary via Composer, I got the following error:

[...]
> Drupal\d2\ScriptHandler::installBinary

In InstallationManager.php line 561:

[TypeError]
Composer\Installer\InstallationManager::getInstallPath(): Argument #1 ($pac kage) must be of type Composer\Package\PackageInterface, null given, called in /var/www/html/web/modules/contrib/d2/src/ScriptHandler.php on line 63

Exception trace: at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:561
Composer\Installer\InstallationManager->getInstallPath() at /var/www/html/web/modules/contrib/d2/src/ScriptHandler.php:63
Drupal\d2\ScriptHandler::getPackageBinaryPath() at /var/www/html/web/modules/contrib/d2/src/ScriptHandler.php:37
Drupal\d2\ScriptHandler::installBinary() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:515
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.p
hp:289
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:142
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:414
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:143
Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:418
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:138 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:112 require() at /usr/local/bin/composer:29

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-a
utoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-a
uthoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-
reqs] [--] [
...]

Composer [install] failed, composer command failed: exit status 1. stderr=

Proposed resolution

TBD

Comments

ergonlogic created an issue. See original summary.

ergonlogic’s picture

So, it turns out, I forgot a step in the Composer installation docs:

"require": {
[...]
    "terrastruct/d2": "0.7.1",
[...]
}

Adding that, fixed the issue above.

ergonlogic’s picture

I suppose that we could add that dependency to this module's composer.json, though presumably with "*" or something.

I think that'd make drupal/d2 uninstallable without the extra package repo in the root Composer file. That's probably the behaviour we want...?

Maybe in the longer run we figure out a way to publish a proper package for this; perhaps on d.o, Packagist or our own Satis. While the latter may seem like overkill, if nothing else, it'd give us a reason to run our own Rugged...

  • ergonlogic committed c07df1f0 on 1.0.x
    docs: #3566478 Document dependency on terrastruct/d2 pseudo package and...
ergonlogic’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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