node.jsvisual-studio-codeasdf-vm

How to use NodeJS debugging in Visual Studio Code with asdf? (cannot find runtime 'node')


Unfortunately Visual Studio Code doesn't find the runtime executable node.

Cannot find node

But the integrated terminal knows about node:

$ which node
/home/user/.asdf/shims/node

How can I introduce node to Visual Studio Code without adding the runtime executable to the launch.json explicitly?

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      [...]
      "runtimeExecutable": "~/.asdf/shims/node" // <- want to avoid this
    }
  ]
}

Solution

  • It seems VSCode first tries to resolve a Node binary before blindly executing it. In my case I didn't have a global Node version set, which causes that check to fail.

    I simply set a global version, VSCode's checks pass, and then it runs the local version happily, without any ASDF-specific launch config.