nystudio107 / generator-craftplugin

generator-craftplugin is a Yeoman generator for Craft CMS plugins
MIT License
73 stars 30 forks source link

TypeError: Cannot read property 'length' of undefined #37

Closed mblode closed 7 years ago

mblode commented 7 years ago

TypeError: Cannot read property 'length' of undefined at child. (/usr/local/lib/node_modules/generator-craftplugin/app/index.js:215:52) at /usr/local/lib/node_modules/generator-craftplugin/node_modules/yeoman-option-or-prompt/index.js:27:19 at child. (/usr/local/lib/node_modules/generator-craftplugin/node_modules/yeoman-generator/lib/base.js:233:7)

khalwat commented 7 years ago

Can you give me some detail on how to reproduce this?

bar9 commented 7 years ago

+1 Using v2.0.0 of yo and v1.3.6 of the generator on a Mac, I never managed to finish the generation process. I get to the components step where it always crashes with the exact same error as mentioned above. I tried several choices of components; also providing them as an command line option but the recipe still crashed at that point.

bar9 commented 7 years ago

Same behaviour with yo v1.8.5

khalwat commented 7 years ago

Can you tell me what parameters you are passing in? Give me an example command, for instance?

bar9 commented 7 years ago

[ Initializing ]
? Select what Craft CMS API to target: Version 3.0.x
[ Prompting ]
? Plugin name: Generic
? Short description of the plugin: This is a generic Craft CMS plugin
? Plugin initial version: 1.0.0
? Plugin author name: John Doe
? Plugin vendor name: Doe Enterprises
? Plugin author URL: http://DoeDesign.com/
? Plugin author GitHub.com name: 
? Should there be code comments generated: (Press <space> to select, <a> to toggle all, <i> to inverse selection)Code Comments
? Select what components your plugin will have: Settings
TypeError: Cannot read property 'length' of undefined
    at child.<anonymous> (/usr/local/lib/node_modules/generator-craftplugin/app/index.js:215:52)
    at /usr/local/lib/node_modules/generator-craftplugin/node_modules/yeoman-option-or-prompt/index.js:27:19
    at child.<anonymous> (/usr/local/lib/node_modules/generator-craftplugin/node_modules/yeoman-generator/lib/base.js:233:7)
    at <anonymous>```

I could reproduce the same behaviour on a completely different machine with Windows.
khalwat commented 7 years ago

So I just did this by hitting return at every option prompt (keeping everything default), and it seemed to work fine:

vagrant@homestead:~/webdev/craft/test$ yo craftplugin

     _-----_
    |       |    ╭──────────────────────────────────────────╮
    |--(o)--|    │ Update available: 2.0.0 (current: 1.8.5) │
   `---------´   │     Run npm install -g yo to update.     │
    ( _´U`_ )    ╰──────────────────────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

[ Initializing ]
? Select what Craft CMS API to target: Version 2.5.x
[ Prompting ]
? Plugin name: Generic
? Short description of the plugin: This is a generic Craft CMS plugin
? Plugin initial version: 1.0.0
? Plugin author name: John Doe
? Plugin author URL: http://DoeDesign.com/
? Plugin author GitHub.com name:
? Should there be code comments generated: (Press <space> to select, <a> to toggle all, <i> to inverse selection)Co
de Comments
? Select what components your plugin will have: (Press <space> to select, <a> to toggle all, <i> to inverse selecti
on)
[ Configuring ]
+ Creating Craft plugin folder generic
[ Writing ]
> Writing template files
+ templates/_Plugin.php wrote to generic/GenericPlugin.php
+ templates/_README.md wrote to generic/README.md
+ templates/_CHANGELOG.md wrote to generic/CHANGELOG.md
+ templates/_LICENSE.txt wrote to generic/LICENSE.txt
+ templates/_releases.json wrote to generic/releases.json
+ templates/_composer.json wrote to generic/composer.json
+ templates/translations/_en.php wrote to generic/translations/en.php
> Copying boilerplate files
+ templates/resources/icon-mask.svg copied to generic/resources/icon-mask.svg
+ templates/resources/icon.svg copied to generic/resources/icon.svg
+ templates/resources/screenshots/plugin_logo.png copied to generic/resources/screenshots/plugin_logo.png
> Sync to file system
   create generic/GenericPlugin.php
   create generic/README.md
   create generic/CHANGELOG.md
   create generic/LICENSE.txt
   create generic/releases.json
   create generic/composer.json
   create generic/translations/en.php
   create generic/resources/icon-mask.svg
   create generic/resources/icon.svg
   create generic/resources/screenshots/plugin_logo.png
[ Install ]
[ End ]
> End install commands
+ Fin. executed
Your Craft CMS plugin Generic has been created.
The default LICENSE.txt is the MIT license; feel free to change it as you see fit.
> All set.  Have a nice day.
khalwat commented 7 years ago

ah, let me try it with the 3.0.x API

khalwat commented 7 years ago

Version 1.3.7 should fix this for you:

https://github.com/nystudio107/generator-craftplugin/releases/tag/1.3.7