vscode: Unable to debug with integrated terminal (WSL)

  • VSCode Version: 1.23.1 & 1.24.0-insider
  • OS Version: Windows 10 - 1803

Steps to Reproduce:

  1. Create a node launch config
  2. Run with console set to “integratedTerminal”

This then launches a new integrated terminal, and executes the following:

➜ cd c:\Code\debug && node --inspect-brk=30756

Which in my case is invalid due to the initial cd c:\Code\debug, as I am using wsl:

cd: no such file or directory: c:Codedebug

I am aware of the previous issues involving this being closed as the problem was fixed, however this no longer seems to be the case.

Sample config:

    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "console": "integratedTerminal",
    }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 17 (5 by maintainers)

Most upvoted comments

We just announced remote development with VS Code, check out the blog post for details https://code.visualstudio.com/blogs/2019/05/02/remote-development

@adityawibisana

node debug app.js might work for you right now, per Node.js Foundation website

The legacy debugger has been deprecated as of Node 7.7.0. Please use --inspect and Inspector instead. […] The V8 Debugging Protocol is no longer maintained or documented.

That was 2 years ago. Unless you have a specific reason to use v7/the old protocol, using --inspect/--inspect-brk is advisable as they are two different mechanisms, not just an alias.

Also the port for --inspect/--inspect-brk defaults to 9229 not 5858 like the old debugger. If your launch config specifies that the port to be used is 5858, you’d need to specify that when spawning the process as well. --inspect=5858/--inspect-brk=5858

Hopefully that clears up any confusion for a visitor from google in a year or two. 😉

@ltomes and @virgilwashere : first I need the extension, and it is working. Turn out that it is working without extension too. Last config:

{
            "name": "WSL fix remoteRoot",
            "type": "node",
            "request": "attach",            
            "address": "localhost",
            "port": 5858,
            "sourceMaps": false,
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "/mnt/d/Projects/yourAwesomeProject" 
}

On my case, most important part is the remoteRoot, which should point to your corresponding folder.

Do note that this one is attach, so you need to manually node debug app.js your project first

I recently created a VS Code extension: WSL workspaceFolder, which may help.

Have you tried "useWSL": true?