Search code examples
node.jsnode-debugger

What file is node debugger breaking in?


I have some code which I am running in debug mode. As I understand it, this runs it through the standard node.js debugger.

I'm frequently getting the following:

...
break in timers.js:77
...

Sometimes I have breakpoints at other files, but they always give absolute file paths, but in this case its just the file name. I cannot find a file with that name which has the content listed on line 77, nor can I find an explanation of how the debugger works in regards to this.

How can I find this timers.js file?


Solution

  • Generally, when you see filenames with no path in the debugger, it means that the file is one of the core libraries that are compiled in to the node binary.

    If you want to dig in to source, make sure you're looking at the git tag that matches the version of node you're running.

    The builtin files are:

    • assert.js
    • buffer.js
    • child_process.js
    • cluster.js
    • console.js
    • constants.js
    • crypto.js
    • dgram.js
    • dns.js
    • domain.js
    • events.js
    • freelist.js
    • fs.js
    • http.js
    • https.js
    • module.js
    • net.js
    • os.js
    • path.js
    • punycode.js
    • querystring.js
    • readline.js
    • repl.js
    • smalloc.js
    • stream.js
    • string_decoder.js
    • sys.js
    • timers.js
    • tls.js
    • tty.js
    • url.js
    • util.js
    • vm.js
    • zlib.js