How do I debug Node.js applications?

后端 未结 30 2533
暗喜
暗喜 2020-11-22 05:56

How do I debug a Node.js server application?

Right now I\'m mostly using alert debugging with print statements like this:

sys.puts(sys.inspe         


        
30条回答
  •  天涯浪人
    2020-11-22 06:30

    Using Chrome Version 67.0.3396.62(+)

    1. Run node app

    node --inspect-brk=0.0.0.0:9229 server.js(server js filename)

    1. Browse your app in chrome e.g. "localhost:port"
    2. Open DevTools.
    3. Click the the node icon beside the responsive device icon.

    There will be another DevTools window that will pop out specifically for debugging node app.

提交回复
热议问题