The console.debug()
function can be invoked in the browser console.
However there is one error when console.debug()
is called in Nodejs.
TypeError: Object #<Console> has no method 'debug'
at Object.<anonymous> (c:\share\node\receive.js:20:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
Why? Is there any way to replace console.debug
in Nodejs?
Open up Preferences > Settings and in the search box type in “node debug”. Under the Extensions tab there should be one extension titled “Node debug”. From here, click the first box: Debug > Node: Auto Attach and set the drop down to “on”. You're almost ready to go now.
To use it, start Node. js with the inspect argument followed by the path to the script to debug. The debugger automatically breaks on the first executable line. To instead run until the first breakpoint (specified by a debugger statement), set the NODE_INSPECT_RESUME_ON_START environment variable to 1 .
When debugging in Node. js, we add a breakpoint by adding the debugger keyword directly to our code. We can then go from one breakpoint to the next by pressing c in the debugger console instead of n . At each breakpoint, we can set up watchers for expressions of interest.
error() function from console class of Node. js is used to display an error messages on the console. It prints to stderr with newline.
There's no console.debug() method in NodeJS. Here is the documentation for the console object, so you can choose the best method for you to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With