mxsdev / nvim-dap-vscode-js

nvim-dap adapter for vscode-js-debug
278 stars 30 forks source link

'$HOME/vscode-js-debug/out/src/vsDebugServer.js' does not exist. Did it build properly? #18

Closed kaykhan closed 1 year ago

kaykhan commented 1 year ago

i have vscode-js-debug installed in my home directory. I ran npm install --legacy-peer-deps && npm run compile without any issues.

  1. i set a break up in my code.
  2. Run F5 and launch (1)
  3. Get the following error:

[dap-js] Error trying to launch JS debugger: ...m/plugged/nvim-dap-vscode-js/lua/dap-vscode-js/utils.lua:64: Debugger entrypoint file '$HOME/vscode-js-debug/out/src/vsDebugServer.js' does not exist. Did it build properly?

Screenshot from 2022-11-18 13-37-40

dap.vim

nnoremap <silent> <F5> <Cmd>lua require'dap'.continue()<CR>
nnoremap <silent> <F10> <Cmd>lua require'dap'.step_over()<CR>
nnoremap <silent> <F11> <Cmd>lua require'dap'.step_into()<CR>
nnoremap <silent> <F12> <Cmd>lua require'dap'.step_out()<CR>
nnoremap <silent> <Leader>b <Cmd>lua require'dap'.toggle_breakpoint()<CR>
nnoremap <silent> <Leader>B <Cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
nnoremap <silent> <Leader>lp <Cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
nnoremap <silent> <Leader>dr <Cmd>lua require'dap'.repl.open()<CR>
nnoremap <silent> <Leader>dl <Cmd>lua require'dap'.run_last()<CR>

lua <<EOF

local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
  dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
  dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
  dapui.close()
end

require("dap-vscode-js").setup({
  -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
  debugger_path = "$HOME/vscode-js-debug", -- Path to vscode-js-debug installation.
  -- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
  adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap
  log_file_path = "(stdpath cache)/dap_vscode_js.log", -- Path for file logging
  -- log_file_level = true, -- Logging level for output to file. Set to false to disable file logging.
  log_console_level = vim.log.levels.ERROR, -- Logging level for output to console. Set to false to disable console output.
})

for _, language in ipairs({ "typescript", "javascript" }) do
  dap.configurations[language] = {
  {
    type = "pwa-node",
    request = "launch",
    name = "Launch file",
    program = "${file}",
    cwd = "${workspaceFolder}",
  },
  {
    type = "pwa-node",
    request = "attach",
    name = "Attach",
    processId = require'dap.utils'.pick_process,
    cwd = "${workspaceFolder}",
  }
}
end

EOF
LemonPy29 commented 1 year ago

As a work around, you can use the absolute path. That solved the issue for me.

kaykhan commented 1 year ago

As a work around, you can use the absolute path. That solved the issue for me.

can you paste your config, still having issues

LemonPy29 commented 1 year ago
require'dap-vscode-js'.setup({
    debugger_path='/Users/myuser/repos/vscode-js-debug',
    adapters = { 'pwa-node', 'node-terminal', 'pwa-extensionHost' },
})

for _, language in ipairs({ "typescript", "javascript" }) do
  require("dap").configurations[language] = {
      {
        type = "pwa-node",
        request = "launch",
        name = "Debug Jest Tests",
        -- trace = true, -- include debugger info
        runtimeExecutable = "node",
        runtimeArgs = {
          "./node_modules/jest/bin/jest.js",
          "--runInBand",
        },
        rootPath = "${workspaceFolder}",
        cwd = "${workspaceFolder}",
        console = "integratedTerminal",
        internalConsoleOptions = "neverOpen",
      }
  }
end

Don't know if this has any relevance but my config is a .lua file.

kaykhan commented 1 year ago

Like you said added absolute path in ubuntu and worked "/home/your_username/vscode-js-debug"