How to print a stack trace in Node.js?
Does anyone know how to print a stack trace in Node.js?
Answer #1 (602 Votes)
Error object has a
stack member that traps the point at which it was constructed.
var stack = new Error().stack console.log( stack )
or more simply:
console.trace("Here I am!")
Answer #2 (195 Votes)
Now there's a dedicated function on console for that: