mxsdev / nvim-dap-vscode-js

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

How to fix `port` `undefined` #23

Closed anasrar closed 1 year ago

anasrar commented 1 year ago

Do not use latest commit https://github.com/microsoft/vscode-js-debug . use v1.74.1.

Error

[dap-js] JS Debugger stderr:
[dap-js] JS Debugger stderr: /path-to/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 (/path-to/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! 

Manually

git clone https://github.com/microsoft/vscode-js-debug
cd vscode-js-debug
git pull
git fetch --all --tags
git checkout tags/v1.74.1
npm install --legacy-peer-deps
npm run compile
JbIPS commented 1 year ago

With Packer

use {
  "microsoft/vscode-js-debug",
  opt = true,
  run = "npm install --legacy-peer-deps && npm run compile",
  tag = 'v1.74.1'
}
mxsdev commented 1 year ago

Thanks for this! And @JbIPS for the packer config.

I think it would be better to set the tag to v1.* though, to still get the latest updates. This should probably be in the readme...

tomaskallup commented 1 year ago

Using v1.* also causes this error for me, had to lock it to v1.74.1.

Seems like they released the breaking change as v1.75.

jessevanassen commented 1 year ago

It should be fixed now and working with the main branch of vscode-js-debug again.

More info: https://github.com/microsoft/vscode-js-debug/issues/1502

anasrar commented 1 year ago

It should be fixed now and working with the main branch of vscode-js-debug again.

More info: microsoft/vscode-js-debug#1502

I got everything work, tested on latest commit https://github.com/microsoft/vscode-js-debug/commit/df2210162933263ec92b73eba560e33bec3eca9d.

should we close this issue ?

Raagh commented 1 year ago

I am still experiencing this on 1.75.1, 1.74.1 works fine though. Really strange, anyone else?

anasrar commented 1 year ago

I am still experiencing this on 1.75.1, 1.74.1 works fine though. Really strange, anyone else?

@Raagh use latest commit.