Debugging node app in WebStorm when run from gulp

2020-06-16 05:32发布

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?

2条回答
地球回转人心会变
2楼-- · 2020-06-16 06:13
【Aperson】
3楼-- · 2020-06-16 06:29

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.

查看更多
登录 后发表回答