+ 6

How to debug a nodejs application?

Hi! Anybody knows how to debug a Web Server application implemented with NodeJS? Any suggestion for a tool?

8th Nov 2019, 8:07 AM
Ludovico Iommi
Ludovico Iommi - avatar
7 Answers
+ 5
To debug node in the browser, type the following: Chrome://inspect Then click on the open node dedicated server On the command line type the following: Node --inspect filename.js,
9th Nov 2019, 8:42 AM
Logomonic Learning
Logomonic Learning - avatar
+ 5
Insert one or more statement debugger; into your nodejs code where you want to insert breakpoint, then run cmd: node inspect <your node.js> on debug> prompt, type next for next statement execution, or type cont to continue execution. or type repl command for variable evaluation.
8th Nov 2019, 8:50 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 4
o.gak Nodejs run directly from server, debugging codes cannot be viewed from front-end browser Chrome devtool.
8th Nov 2019, 2:52 PM
CalviŐ˛
CalviŐ˛ - avatar
+ 3
CalviŐ˛ Thank you for your explanation.:)
8th Nov 2019, 3:00 PM
o.gak
o.gak - avatar
+ 3
VSCode Will let you debug your Node code in user-friendly way
9th Nov 2019, 5:06 PM
Sarthak
Sarthak - avatar
+ 3
console.log is very useful for me, try to explore more the console methods
10th Nov 2019, 7:48 AM
Joy
Joy - avatar
+ 2
A Chrome debug tool? Open the web page in Chrome and push `ctrl + shift + i`.
8th Nov 2019, 1:10 PM
o.gak
o.gak - avatar