Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

javascript - Node.js Debugging flow

I'd like to debug node.js like rails. I've tried several ways:

  1. Webstorm debug – in this case I need to click "rerun debug" each time after code changed
  2. Nodemon with chrome remote debugger – in this case I need to reconnect to debugger each time after code reloaded by nodemon
  3. pry.js – here I need to type "eval(pry.it)" – and have no option to make it simpler like "debug" or pry()

So what's the best option to debug node apps like byebug for rails?

Upgrade:

Thx to @AbhinavD I've managed to do it in VSCode: First you need to edit app/.vscode/launch.js javascript { "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name": "Node: Nodemon", "processId": "${command:PickProcess}", "restart": true, "protocol": "inspector", }, ] } So now nodemon restarts server after changes and VSCode reconnect to debugger automatically.

See video https://vimeo.com/267975071

Is anybody able to do it in WebStorm?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To answer your question: There is no way. Unfortunately, with Node.js, you always have to restart the debugging session when you change your code ??.

I've recently written an article about debugging both JavaScript and TypeScript using different tools, if you're interested, but there's nothing like live debugging.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...