Open kamoshi opened 8 months ago
I have the same error. were you able to solve it?
I haven't been able to solve this problem, but I found a different way to install JS debugger, not via Mason. This is less than ideal, because you have to build vscode-js-debug
yourself and I'm not sure if this still works
{
'mxsdev/nvim-dap-vscode-js',
dependencies = {
'microsoft/vscode-js-debug',
version = '1.x',
build = 'npm i && npm run compile vsDebugServerBundle && mv dist out',
},
config = function()
local dap = require 'dap'
--local utils = require 'dap.utils'
local dap_js = require 'dap-vscode-js'
--local mason = require 'mason-registry'
---@diagnostic disable-next-line: missing-fields
dap_js.setup {
-- debugger_path = mason.get_package('js-debug-adapter'):get_install_path(),
debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug',
adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
}
local langs = { 'javascript', 'typescript', 'svelte', 'astro' }
for _, lang in ipairs(langs) do
dap.configurations[lang] = {
{
type = 'pwa-node',
request = 'attach',
name = 'Attach debugger to existing `node --inspect` process',
cwd = '${workspaceFolder}',
skipFiles = {
'${workspaceFolder}/node_modules/**/*.js',
'${workspaceFolder}/packages/**/node_modules/**/*.js',
'${workspaceFolder}/packages/**/**/node_modules/**/*.js',
'<node_internals>/**',
'node_modules/**',
},
sourceMaps = true,
resolveSourceMapLocations = {
'${workspaceFolder}/**',
'!**/node_modules/**',
},
},
}
end
end,
},
Good god! I've spent hours fiddling with this. I almost gave up until I stumbled onto this... Thank you!
As far as I can tell this isn't related to mason, see my comment here https://github.com/mxsdev/nvim-dap-vscode-js/issues/43#issuecomment-2292493558
I'm not sure why @kamoshi 's answer used to work but it doesn't seem to anymore - maybe they released the same bug in version = '1.x',
later?
I tried to use this extension with Mason, so I passed it the path from the registry
However, when trying to attach to a process I get the following error: