运行 drupal generate:module 时路径“/modules/custom”无效

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

我正在尝试使用 drupal-console 安装 Drupal 插件。 我 运行 它在 /var/www/drupalvm/drupal/web$

我检查了我的 drupal.composer.json 文件,我相信一切都是正确的

"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"]
}

我运行:

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"

谢谢

问题是您提供的绝对 --module-path 作为 /modules/custom 在您的系统中不存在。

您需要提供相对路径或现有的绝对路径。

解决方案是省略前导 / 或使用绝对路径:

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