468,490 Members | 2,603 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,490 developers. It's quick & easy.

Is there a better way to log and debug objects in Node?

3 2Bits
I am developing a server-side app that cannot run in the browser, and therefore I cannot debug with DevTools.

If I want to debug an object I need to print the object to shell using

JSON.stringify OR require('util').inspect
These work okay but it's not anywhere near as good as a browser's DevTools.

So, I am wondering, is there a better way to debug objects? Is there some sort of DevTools like shell for Node. I am guessing the answer is "no", but I am asking anyway.
Feb 14 '21 #1
1 1124
dreamtext
16 16bit
You have to enable inspector when you run your node server locally by using the --inspect switch.

This will open up a port where node will communicate with an inspector client usually on port : 9229

Use this as a resource:
https://nodejs.org/en/docs/guides/de...tting-started/
Feb 14 '21 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Yannick | last post: by
8 posts views Thread by Ryan Stewart | last post: by
2 posts views Thread by ademirzanetti | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.