我正在创建我的第一个(真正的)Yeoman.io 生成器,它有一些嵌套提示(即一个提示的答案会影响其他提示和操作的呈现)。
我已经跟踪了我的代码,从表面上看,我似乎在适当地“打开和关闭”我的提示,但在脚本的最后,看起来仍然有一个打开的 readline(来自 Inquirer.js),并且在 readlines 关闭后会触发额外的 onCompletion 。
我将假设这不是库(Yeoman.io 或 Inquirer.js)的问题,而是我提示的方式有问题,或者有不同的方式来做我正在做的事情试图做。
INQUIRER onCompletion
Prompted for initialize, user said true
User said to initialize, exec git init
INQUIRER onCompletion
INQUIRER ERROR: TypeError: Cannot call method 'removeListener' of null
GITHOOKS PROMPT: undefined
GITHOOKS PROMPT: undefined
/untethered/app/index.js:178
cb();
^
TypeError: undefined is not a function
at UntetheredGenerator.<anonymous> (/untethered/app/index.js:178:3)
at Object.<anonymous> (/untethered/node_modules/yeoman-generator/node_modules/inquirer/lib/inquirer.js:88:7)
代码在这里:https ://github.com/pollensoft/untethered/blob/master/app/index.js