craftcms / generator

Scaffold new Craft CMS plugins, modules, and system components from the CLI
MIT License
84 stars 8 forks source link

No plugin exists with the handle "test" #23

Closed anchovy closed 8 months ago

anchovy commented 1 year ago

Description

When trying to create a new field type I'm getting the error: No plugin exists with the handle "test" I'm following the docs so not sure what's going on?

Steps to reproduce

  1. Open console
  2. 
    $ php craft make field-type --plugin=test

Exception 'craft\errors\InvalidPluginException' with message 'No plugin exists with the handle "test".'

in /site/vendor/craftcms/cms/src/services/Plugins.php:889

Stack trace:

0 /site/vendor/craftcms/generator/src/Command.php(200): craft\services\Plugins->createPlugin('test')

1 [internal function]: craft\generator\Command->actionGenerate('field-type')

2 /site/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

3 /site/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)

4 /site/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)

5 /site/vendor/craftcms/cms/src/console/ControllerTrait.php(87): yii\console\Controller->runAction('', Array)

6 /site/vendor/craftcms/cms/src/console/Controller.php(217): craft\console\Controller->traitRunAction('', Array)

7 /site/vendor/craftcms/generator/src/Command.php(131): craft\console\Controller->runAction('', Array)

8 /site/vendor/yiisoft/yii2/base/Module.php(552): craft\generator\Command->runAction('', Array)

9 /site/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('make', Array)

10 /site/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction('make', Array)

11 /site/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('make', Array)

12 /site/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest(Object(craft\console\Request))

13 /site/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))

14 /site/craft(13): yii\base\Application->run()

15 {main}



### Additional info

- Craft version: 4.4.14
- PHP version: 8.0.2
- Database driver & version: 8.0.31
- Plugins & versions: 

    "craftcms/cms": "4.4.14",
    "craftcms/feed-me": "5.1.3.1",
    "jamesedmonston/graphql-authentication": "2.4.0",
    "mmikkel/cp-field-inspect": "^1.4",
    "mmikkel/incognito-field": "^1.3",
    "nette/utils": "^4.0",
    "percipioglobal/craft-colour-swatches": "^4.3",
    "putyourlightson/craft-sendgrid": "^2.0",
    "verbb/field-manager": "^3.0",
    "verbb/single-cat": "^3.0",
    "verbb/super-table": "3.0.8.1",
    "vlucas/phpdotenv": "^5.4.0"
    "craftcms/generator": "^1.5",
    "yiisoft/yii2-shell": "^2.0.3"
brandonkelly commented 1 year ago

Do you already have a plugin installed with the handle test?

smalomo commented 1 year ago

Getting the same error when trying to create a new field-type using the ReadMe sample: php craft make field-type --plugin=foo-bar

Exception 'craft\errors\InvalidPluginException' with message 'No plugin exists with the handle "foo-bar".'

Should the module or plugin already exist before running the generator?

Versions: "craftcms/cms": "4.4.10.1", "craftcms/generator": "1.4.0",

Edited to answer my own question: the module needs to be generated first, before you can create a field-type. I jumped the gun and scrolled down to the components where I saw the field-type example in the ReadMe. For anyone else who is confused or gets stuck on this, start with the module generator first:

  1. php craft make module my-test
  2. composer dump-autoload
  3. php craft make field-type --module=my-test
brandonkelly commented 1 year ago

Should the module or plugin already exist before running the generator?

Yes.