Search code examples
composer-phpdrupal-8drupal-console

Path "/modules/custom" is invalid while runing drupal generate:module


I'm trying to install a Drupal's plugin while using drupal-console. I run it in /var/www/drupalvm/drupal/web$

I checked my drupal.composer.json file and everything is correct i believe

"installer-paths": {
    "web/core": ["type:drupal-core"],
    "web/modules/contrib/{$name}": ["type:drupal-module"],
    "web/profiles/contrib/{$name}": ["type:drupal-profile"],
    "web/themes/contrib/{$name}": ["type:drupal-theme"],
    "drush/contrib/{$name}": ["type:drupal-drush"]
}

What i run:

drupal generate:module   --module="My checkout flow"
--machine-name="my_checkout_flow"
--module-path="/modules/custom"
--description="My checkout flow"
--core="8.x"
--package="LSB"
--composer
--dependencies="commerce:commerce_checkout"

Thank you


Solution

  • The problem is you're providing an absolute --module-path as /modules/custom which doesn't exist on your system.

    You need to provide a relative path or existing absolute path instead.

    The solution is to either omit the leading / or use the absolute path:

    --module-path='modules/custom'
    # ... or ...
    --module-path="$(realpath modules/custom)"