How do I debug Node.js applications?

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

    Just for completeness:

    The PyCharm 3.0 + Node.js Plugin offers an awesome development + run + debug experience.

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

    Visual Studio Code will be my choice for debugging. No overhead of installing any tools or npm install stuff. Just set the starting point of your app in package.json and VSCode will automatically create a configuration file inside your solution. It's build on Electron, on which editors like Atom are built.

    VS Code gives similar debugging experience as you might have had in other IDEs like VS, Eclipse, etc.

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

    If you are using the Atom IDE, you can install the node-debugger package.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • Node.js Tools for Visual Studio 2012 or 2013 includes a debugger. The overview here states "Node.js Tools for Visual Studio includes complete support for debugging node apps.". Being new to Node.js, but having a background in .NET, I've found this add in to be a great way to debug Node.js applications.

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

    Use Webstorm! It's perfect for debugging Node.js applications. It has a built-in debugger. Check out the docs here: https://www.jetbrains.com/help/webstorm/2016.1/running-and-debugging-node-js.html

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