2

I updated VS Code to 1.14.2 and am attempting to run an application that requires Node 6.x. Prior to this update, the configuration I was using worked just fine:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/keystone.js"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Port",
            "address": "localhost",
            "port": 5858
        }
    ]
}

now, when I execute the program, it just hangs without starting (expected when I run with Node 7.x or above). In addition, it provides the following message, which I'm not sure is relevant:

Debugging with inspector protocol because Node.js v8.2.1 was detected.

node --inspect=38743 --debug-brk keystone.js

Debugger listening on ws://127.0.0.1:38743/d4a20480-3a0f-4aa7-8882-aec756edd6da Debugger attached.

I'm using nvm to manage my Node versions, and nvm list provides the following (as you can see, I already have 6.11.0 aliased to default):

$ nvm list
->      v6.11.0
         v8.0.0
         system
default -> 6.11.0 (-> v6.11.0)
node -> stable (-> v8.0.0) (default)
stable -> 8.0 (-> v8.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.8.4 (-> N/A)
lts/boron -> v6.11.1 (-> N/A)

I'm assuming it's not executing due to trying to use the wrong version of Node, and any help figuring this out would be greatly appreciated.

autoboxer
  • 1,358
  • 1
  • 16
  • 37

1 Answers1

1

Not sure which version of VS Code introduced this option (I am using version 1.17.2) but in launch.json, we can explicitly specify which debug protocol to use.

So, to force VS Code to use legacy protocol, add "protocol": "legacy"

Here's your launch.json updated to include that key:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/keystone.js"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Port",
            "address": "localhost",
            "port": 5858,
            "protocol": "legacy"
        }
    ]
}
An Vad
  • 426
  • 3
  • 7