How do I debug Node.js applications?

后端 未结 30 2479
暗喜
暗喜 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:45

    Node has its own built in GUI debugger as of version 6.3 (using Chrome's DevTools)

    Simply pass the inspector flag and you'll be provided with a URL to the inspector:

    node --inspect server.js
    

    You can also break on the first line by passing --inspect-brk instead.

提交回复
热议问题