Skip to content

Cannot start adapter: port is undefined #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JbIPS opened this issue Jan 6, 2023 · 2 comments
Closed

Cannot start adapter: port is undefined #22

JbIPS opened this issue Jan 6, 2023 · 2 comments

Comments

@JbIPS
Copy link

JbIPS commented Jan 6, 2023

I tried to launch a debug session on the current file with the provided config:

local dap = require("dap")

-- Languages
require("dap-vscode-js").setup({
  -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
  -- debugger_path = "(runtimedir)/site/pack/packer/opt/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 = false -- 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
  require("dap").configurations[language] = {
  {
    type = "pwa-node",
    request = "launch",
    name = "Launch file",
    program = "${file}",
    cwd = "${workspaceFolder}",
    sourceMaps = true
  }
}
end

When starting a new session I got :

[dap-js] JS Debugger stderr:
[dap-js] JS Debugger stderr: /home/jbrichardet/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:93                                                                                                                 
    console.log((result.server.address() as net.AddressInfo).port.toString());                                                                                                                                                                
                                                                 ^                                                                                                                                                                            
TypeError: Cannot read properties of undefined (reading 'toString')                                                                                                                                                                           
    at VsDebugServer.launchRoot (/home/jbrichardet/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/src/vsDebugServer.ts:93:66)                                                                                                         
    at processTicksAndRejections (node:internal/process/task_queues:95:5)     
[dap-js] JS Debugger exited with code 1! 

I tried to look for a port to set but I did not find any in the adapter config or the configuration. Did I miss something ?

Thank you

@anasrar
Copy link

anasrar commented Jan 7, 2023

@JbIPS
Copy link
Author

JbIPS commented Jan 9, 2023

Thank you! That fixes it

@JbIPS JbIPS closed this as completed Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants