javascript - 如何调试 gulpfile.js

标签 javascript node.js debugging gulp node-inspector

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

我试过以下(我的 gulpfile 中的代码需要 harmonyharmony-arrow-functions 开关):

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

Node 检查器已正确加载,但无法在文件为 loaded 之前或之后在 gulpfile 中设置断点.也无法在 gulp/index.jsorchestrator/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/

相关文章:

node.js - fs.createWriteStream 重新启动在 PM2 上运行的应用程序

ios - Unity 在 iPhone 6 Plus 上性能缓慢

c++ - 测量由我的程序引起的设备驱动程序 CPU/IO 利用率

ruby - 如何使用 Intellij 12.1.7 调试 Ruby 2.1.1p76

javascript - 搜索对象的更好方法

javascript - 函数内循环

php - Javascript 将内联变量传递给外部 : security issue?

html - JavaScript 警报框

node.js - 使用带有 Node.js 的 postgres+sequelize 的控制台?

javascript - 从菜单Electron.js调用其他文件上的函数