How do I debug Node.js applications?

后端 未结 30 2010
暗喜
暗喜 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条回答
  • Visual Studio Code will work for us in debugging.

    0 讨论(0)
  • 2020-11-22 06:42

    If you need a powerful logging library for Node.js, Tracer https://github.com/baryon/tracer is a better choice.

    It outputs log messages with a timestamp, file name, method name, line number, path or call stack, support color console, and support database, file, stream transport easily. I am the author.

    0 讨论(0)
  • Node.js version 0.3.4+ has built-in debugging support.

    node debug script.js

    Manual: http://nodejs.org/api/debugger.html

    0 讨论(0)
  • 2020-11-22 06:44

    There is the new open-source Nodeclipse project (as a Eclipse plugin or Enide Studio):

    Nodeclipse became #1 in Eclipse Top 10 NEW Plugins for 2013. It uses a modified V8 debugger (from Google Chrome Developer Tools for Java).

    Nodeclipse is free open-source software released at the start of every month.

    0 讨论(0)
  • 2020-11-22 06:44

    Use this commands

    DEBUG_LEVEL=all node file.js
    DEBUG=* node file.js
    node file.js --inspect
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题