Mafalda Hopkirk
Mafalda Hopkirk

Reputation: 31

Cannot run deno debugger on vscode

I am a reccent deno user. Been using node for a long time, switched to deno and am very happy with it. It's really good

However, I have an issue.
Whenever I try to debug a deno file, the vscode debugger starts running for like half a second and then stops, and nothing happens. It doesnt freeze or anything, it just starts for a moment and stops.

I am using this as launch configuration

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Deno1",
            "type": "node",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "deno",
            "outputCapture": "std",
            "runtimeArgs": ["run", "--inspect-brk", "-A", "${fileName}"],
            "port": 9229,

        }
    ]
}

I took it from this post

I should add that I was able to debug this file already, but one day it just started showing this issue i just described without (to my knowledge) any change on my part.

I am trying to debug this file

How can I fix this issue?

Upvotes: 3

Views: 922

Answers (1)

Zwiers
Zwiers

Reputation: 3658

To make it work you need to add a "program" field to launch.json and move the path of the file there, which is briefly mentioned in this answer from the post you linked to. But also you need to change "port" to "attachSimplePort":

{
    "version": "0.2.0",
    "configurations": [
        {
            "request": "launch",
            "name": "Launch Program",
            "type": "node",
            "program": "${workspaceFolder}/main.ts", 
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "run",
                "--inspect-wait",
                "--allow-all"
            ],
            "attachSimplePort": 9229,
            "outputCapture": "std",
        }
    ]
}

You can change the file in program if your program has an entrypoint different from main.ts. With this config you should be able to debug using F5 in VS Code and stop at any break points.

Upvotes: 2

Related Questions