为了能够调试 gulpfile.js
,执行 node-inspector
的正确方法是什么?
我试过以下(我的 gulpfile 中的代码需要 harmony
和 harmony-arrow-functions 开关
):
node-debug --nodejs --harmony --nodejs --harmony-arrow-functions /home/user/.npm-packages/bin/gulp default
Node 检查器已正确加载,但无法在文件为 loaded 之前或之后在 gulpfile 中设置断点.也无法在 gulp/index.js
和 orchestrator/index.js
文件中设置断点。并且不可能“步入”以下声明(whole source):
gulpInst.start.apply(gulpInst, toRun);
环境:
- 软呢帽 21 x64
- Node 检查器 v0.9.2
- Node v0.12.0
- 一饮而尽
- CLI 版本 3.8.11
- 本地版本 3.8.11
最佳答案
看起来您没有指向实际的 gulpfile.js。尝试这样的事情:
node-debug /path/to/your/gulp/install/gulp.js --harmony --harmony-arrow-functions --gulpfile /path/to/your/gulpfile/gulpfile.js default
我用过它,效果很好。
关于javascript - 如何调试 gulpfile.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29201843/