How to debug gulpfile.js

核能气质少年 提交于 2019-12-01 03:06:19

问题


What is the proper way to execute node-inspector in order to be able to debug gulpfile.js?

I've tried following (code in my gulpfile requires harmony and harmony-arrow-functions switches):

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

Node inspector was properly loaded however it was not possible to set breakpoint in gulpfile neither before nor after the file was 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):

gulpInst.start.apply(gulpInst, toRun);
Environment:
  • Fedora 21 x64
  • Node Inspector v0.9.2
  • node v0.12.0
  • gulp
    • CLI version 3.8.11
    • Local version 3.8.11

回答1:


It looks like you're missing pointing to your actual gulpfile.js. Try something like this:

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

I use this and it works.



来源:https://stackoverflow.com/questions/29201843/how-to-debug-gulpfile-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!