JavaScript

How to Fix Missing vsDebugServer.js in Neovim TypeScript Debugging

How to Fix Missing vsDebugServer.js in Neovim TypeScript Debugging

I’ve recently been diving into Neovim as a full development environment, and one of the things I really wanted to set up was debugging for TypeScript and JavaScript using DAP (Debug Adapter Protocol).

Well it didn’t go as smoothly as I hoped.

The first time I tried launching the debugger, I was greeted with this delightful error:

Error trying to launch JS debugger: ...utils.lua:64:
Debugger entrypoint file 'C:\Users\MyName\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\ms-vscode.js-debug\out/src/vsDebugServer.js' does not exist.

At first, I thought I had messed up a path somewhere but after digging deeper, I found out the problem wasn’t me.

What Does This Error Actually

I was using the following configuration in my init.lua, assuming I could reuse the built in js debug that ships with Visual Studio Code:

require('dap-vscode-js').setup({
  adapters = { 'pwa-node', 'pwa-chrome' },
  debugger_path = "C:\\Users\\MyName\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug"
})

However the ms-vscode.js-debug extension from newer versions of VS Code no longer includes:

out/src/vsDebugServer.js

So Neovim tries to launch a file that simply doesn’t exist anymore, and everything falls apart.

The Solution Manually Point to the Right js-debug Server

Instead of relying on dap-vscode-js to magically find the adapter, I manually configured it using a downloaded version of js-debug-dap.

Final Working Setup (Drop This Into Your DAP Config)

local dap = require('dap')

require("dap").adapters["pwa-node"] = {
  type = "server",
  host = "::1",
  port = 8000,
  executable = {
    command = "node",
    args = {"C:\\Users\\JasonEvans\\Downloads\\js-debug-dap-v1.102.0\\js-debug\\src\\dapDebugServer.js", "8000"},
  }
}

require("dap").configurations.typescript = {
  {
    type = "pwa-node",
    request = "launch",
    name = "Launch file",
    program = "${file}",
    cwd = "${workspaceFolder}",
  },
}

Make sure to replace the path to match wherever you extracted the js-debug folder.

Enable Debugging for JavaScript Too

If you want to reuse the same setup for .js files:

require("dap").configurations.javascript = dap.configurations.typescript

Now I can debug:

index.ts
server.js
React / Next.js .tsx files (if mapped to typescriptreact)

Productivity Boost Add Useful Keybindings

vim.keymap.set("n", "<F5>", ":lua require'dap'.continue()<CR>")
vim.keymap.set("n", "<F10>", ":lua require'dap'.step_over()<CR>")
vim.keymap.set("n", "<F11>", ":lua require'dap'.step_into()<CR>")
vim.keymap.set("n", "<F12>", ":lua require'dap'.step_out()<CR>")

These keybindings make Neovim debugging feel almost like VS Code.

Final Thought

At first, I thought “debugging in Neovim is too complicated”, but the real issue was simply a missing file due to updated folder structures in js-debug. Once I manually pointed the adapter to dapDebugServer.js, everything started working flawlessly.

Rick Bowen (JavaScript)

About Rick Bowen (JavaScript)

Hi, I'm Rick! I'm an accomplished Software Engineer with broad and deep expertise in Go JavaScript, TypeScript, Shell (bash/zsh), Git, SQL & NoSQL Databases, Containers + Kubernetes, Distributed Systems, Reliability Engineering, DevOps, Cloud / Network / Application Security, Identity / Access Management, Linux, macOS/Darwin, CI/CD, SaltStack, Terraform, AWS, GCP, Azure, Internet Protocols, and much more.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments