دنبال کننده ها

۱۳۹۶ مرداد ۹, دوشنبه

node.js - Debugging in Visual Studio Code with Windows Subsystem for Linux

[ad_1]



I'm trying to setup a debug configuration for running tests in Node app using Mocha.
I have Ubuntu running as a Windows Subsystem for Linux and my Visual Studio Code is setup to use Bash as the integrated terminal.



Here is my launch.json configuration:




"name": "Launch via NPM",
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"cwd": "$workspaceRoot",
"runtimeExecutable": "npm",
"runtimeArgs": [
"test"
],
"protocol": "inspector",
"port": 5858

...



This will run my tests in the integrated terminal, but will always time out when trying to attach to the debugger, with the following error:



Error message



Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:5858).



Also here is what it shows in the terminal before it starts running the tests:



cd c:UsersabcMyProject ; npm test
-bash: cd: c:UsersabcMyProject : No such file or directory


Any idea how to make sure it connects the debugger?




[ad_2]

لینک منبع