带有嵌套提示的Yeoman.io会在Inquirer.js中产生未定义的错误

我创build我的第一个(真正的)Yeoman.io生成器,它有一些嵌套的提示(即一个提示的答案影响其他提示和操作的表示)。

我追踪了我的代码,表面上看起来好像是“适当地打开和closures”我的提示,但是在脚本的最后,看起来仍然有一个开放的readline(来自Inquirer.js), readlines被closures后,一个额外的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

修正了这里:github.com/pollensoft/untethered/commit/… SO不会让我回答自己的问题8个小时。 如果我忘记回来,这可能看起来没有答案。 方式去堆栈溢出! 🙂