You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用nvim-dap调试远程TypeScript Vitest单元测试?

远程调试Vite TypeScript单元测试时nvim-dap断点失效问题

我在域名remoteserver的远程服务器上运行Vite TypeScript单元测试,执行命令:

node --inspect-brk=0.0.0.0 ./node_modules/vitest/vitest.mjs run --threads false src/backend/api.spec.ts

当使用nvim-dap附加调试时,出现报错:

Breakpoint ignored because generated code not found (source map problem?).

我的nvim-dap配置如下:

适配器配置:

dap.adapters = {
    node2 = {
        type = 'executable',
        command = 'node',
        args = {
            '/var/git/github.com/microsoft/vscode-node-debug2/out/src/nodeDebug.js'
        }
    }
}

TypeScript调试配置:

dap.configurations.typescript =
    {
        {
            type = "node2",
            address = "remoteserver",
            port = 9229,
            request = "attach",
            sourceMaps = true
        }
    }

更新:VS Code可以正常触发调试断点,但nvim-dap即便设置了sourceMaps = true,还是无法正确识别源映射导致断点失效。

内容的提问来源于stack exchange,提问作者Lajos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 13:57:28