Debugging node app in WebStorm when run from gulp

£可爱£侵袭症+ 提交于 2019-12-04 20:46:42

问题


I am using webstorm 10.0.2 and have used the bangular yeoman template to generate a project. I can run the gulp commands via the gulp window, and I can set a breakpoint in the gulpfile.js and it will hit it, but I can't seem to get it to hit a breakpoint in my server.js

It looks to me like the gulp file is launching another instance of node and thus when you do "debug" from webstorm you are just debugging the gulp.

I also tried with another project using yo hottowel but get the same thing - I am unable to debug the actual application through webstorm.

Can anybody tell me how to configure webstorm so that I can debug the actual server side node code but still use the gulp build tool?


回答1:


I contacted JetBrains support back in May 2015 and their response was:

It seems this cannot be done quickly. In short, the problem is that serve-dev task starts new process (nodemon) that takes app.js There is no workaround how to debug such spawned processes right now. We would really appreciate if you'll submit a feature request about it in our YouTrack: https://youtrack.jetbrains.com/issues/WEB The only way you can try to avoid it - try to create a separate task that will run app.js directly without nodemon process and debug this task instead.




回答2:


It seems the best option is to use https://www.npmjs.com/package/gulp-node-inspector



来源:https://stackoverflow.com/questions/30014187/debugging-node-app-in-webstorm-when-run-from-gulp

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