如何调试 gulpfile.js

How to debug gulpfile.js

为了能够调试 gulpfile.js,执行 node-inspector 的正确方法是什么?

我试过以下(我的 gulp 文件中的代码需要 harmonyharmony-arrow-functions switches):

node-debug --nodejs --harmony --nodejs --harmony-arrow-functions /home/user/.npm-packages/bin/gulp default

节点检查器已正确加载,但无法在文件 loaded. It was also not possible to set breakpoints in gulp/index.js and orchestrator/index.js files. And it was not possible to "step into" following statement (whole source 之前或之后在 gulp 文件中设置断点:

gulpInst.start.apply(gulpInst, toRun);
环境:

您似乎没有指向您的实际 gulpfile.js。尝试这样的事情:

node-debug /path/to/your/gulp/install/gulp.js --harmony --harmony-arrow-functions --gulpfile /path/to/your/gulpfile/gulpfile.js default

我用过这个,效果很好。