vscode: Node JS debugging is inconsistent

Issue Type: Bug

When using the built-in debugger for Node JS scripts, I’ve noticed that the accuracy of the debugger in terms of line placement and breakpoints is extremely hit or miss in 1.2.5.0 (worked perfectly in 1.2.4). A few issues I’ve run into:

  • With source maps enabled, the actual file opened in debugging will sometimes be wrong (if there are files in different directories with the same name, e.g., utils.js).

  • Breakpoints will not respect the original line they were placed at, and will instead be indicated at a completely different location (even though the variables context is technically correct)

  • Debugger statements will halt execution in the correct location, but the debugger itself will choose a random location in the file (or possibly a different file…see above).

Unfortunately, this isn’t 100% consistent; some files work as expected, others fail in one or two areas of the issues above, others are completely messed up. I’m not sure of the difference in the files, other than possibly collisions in files with the same name under different directories.

Here is the script I use to start my node script: "./node_modules/.bin/nodemon app/server.js --inspect --exec ./node_modules/.bin/babel-node"

And here is the launch config:

{
    "type": "node",
    "request": "attach",
    "name": "Debug",
    "processId": "${command:PickProcess}",
    "restart": true,
    "protocol": "inspector",
    "sourceMaps": false // tried both true and false
}

As I mentioned above, this configuration worked in 1.24, and the debuggin experience was superb. In 1.25.0, the debugging experience has significantly degraded, making it nearly unusable.

Please let me know if there is any other information I can provide to help facilitate a speedy fix for this. Thanks for this awesome product; hoping the debugging gets back up to snuff soon!

VS Code version: Code 1.25.0 (0f080e5267e829de46638128001aeb7ca2d6d50e, 2018-07-05T13:02:28.333Z) OS version: Darwin x64 17.5.0

System Info
Item Value
CPUs Intel® Core™ i7-7820HQ CPU @ 2.90GHz (8 x 2900)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.02GB free)
Process Argv /Applications/Visual Studio Code.app/Contents/MacOS/Electron -psn_0_2495073
Screen Reader no
VM 0%
Extensions (10)
Extension Author (truncated) Version
vscode-nsp ada 1.0.1
vscode-eslint dba 1.4.12
vscode-babel-coloring dza 0.0.4
vscode-great-icons emm 2.1.36
auto-rename-tag for 0.0.15
icon-fonts idl 2.1.0
debugger-for-chrome msj 4.7.0
indent-rainbow ode 7.2.2
vscode-todo-highlight way 0.5.12
markdown-all-in-one yzh 1.5.1

(2 theme extensions excluded)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@danielvy @rynmng On #54026, I noticed a comment about a possible workaround:

// add to launch.json
"pathMapping": {
    "/": "/"
}

I tried it in 1.25.1, and debugging seems to be working again for me as expected. You might try it out if you need a quick fix!