调试 Generators

To debug a generator, you can pass Node.js debug flags by running it like this:

# OS X / Linux
node --debug `which yo` <generator> [arguments]

# Windows
# Find the path to the yo binary in Command Prompt
where yo
# Or find the path to the yo binary in PowerShell
get-command yo
# Would be something like C:\Users\<USER>\AppData\Roaming\npm\yo
# Use this path to derive yo cli.js file
# C:\Users\<USER>\AppData\Roaming\npm\node_modules\yo\lib\cli.js
node --debug <path to yo cli.js> <generator> [arguments]

Yeoman generators also provide a debug mode to log relevant lifecycle information. You can activate it by setting the DEBUG environment variable to the desired scope (the scope of the generator system is yeoman:generator).

# OS X / Linux
DEBUG=yeoman:generator

# Windows
set DEBUG=yeoman:generator
发现一个错误?一个不清楚的例子?通过派生并发送你的修改和建议来帮助我们改进文档。改善此页面!