Whenever I try to run the debugger, I keep getting this error:
This is the debug configurations:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/server/bin/www",
"envFile": "${workspaceRoot}/server/.env"
}
]
}
---- Update ----
I am using VScode version 1.49.0
As #S.Clarke876 mentioned, it appears to be a bug in VS Code, that should be fixed in the next release. See: https://github.com/microsoft/vscode/issues/106484#issuecomment-691202789
You can work around the issue by adding "outputCapture": "std" to your launch.json file.
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/server/bin/www",
"envFile": "${workspaceRoot}/server/.env",
"outputCapture": "std"
}
]
}
Worked for me! It only appeared to happen when the npm package debug attempted to write out to the console. I.e. console.log was fine.
Thanks again, #S.Clarke876! Only adding this answer as I nearly missed your comment.
Related
When I am debugging my python code it skips over code not written by me. I've set justmycode to false and I've tried updating request however, it won't accept any values except launch or attach and purpose is set to debug-test. Nothing seems to work.
My JSON file:
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode":false,
"purpose": ["debug-test"]
}
]
}
The message from the debugger(yes, I stepped in not over):
Frame skipped from debugging during step-in.
Note: may have been skipped because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).
Sorry if this a stupid question I am a newbie and feeling totally over my head in my internship.
Literally this is my entire code. The message from the debugger appears when I try to step into execute().
pQuery=p.logquery()
pQuery.execute()
I had a similar problem just now and it suddenly started working when I set the justMyCode option to the end of the configuration without a comma at the end of the line.
So, not working:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
}
]
}
And working example:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
I cannot fathom why this is the case. If this works for you as well, please let me know.
The official docs on how to do it are here.
The OP was specifically adding a launch configuration for debugging tests. However, over here it's mentioned you should set "request": "test" for "for justMyCode to work with test debugging".
{
"name": "Python: Debug Tests",
"type": "python",
"request": "test",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
Which is not so clearly explained in the official docs... but worked for me.
I am getting an error while debugging nodejs in vscode: Can not connect to runtime process, timeout after 10,000 ms - (can not connect to the target)
enter image description here
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\server\\js.js"
}
]
}
Why am I getting this error? And how can I fix it?
I am trying to use the vs code debugger for my node.js application and all the commands and code but when i apply the break point it goes back to the main files and function of the nodejs and npm files instead of going back step by step to the service and then storage, brake points not working properly for my apis any body can help
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?
linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app/app.js"
},
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229
},
{
"type": "node",
"request": "launch",
"name": "My Debugger",
"program": "${workspaceFolder}\\index.js"
}
]
}
Have you tried attaching to a node process?
Step 1: Run the code.
Step 2: Press CMD + SHIFT + P then search for "Attach to Node Process" and it will list the running processes.
Step 3: Choose the process you want to attach to.
This enables debugging.
I have my unit tests written in jasmine and those are in typescript
// about.service.spec.ts
// say 4 to 5 test cases
// spec/support/jasmine.json
{
"spec_dir": "src/tests/",
"spec_files": ["**/*.spec.ts"],
"helpers": ["jasmine-helpers/**/*.ts"],
...
}
// launch.json - vscode file
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Jasmine tests",
"preLaunchTask": "debuggertests",
}]
}
// tasks.json - vscode
{
"version": "2.0.0",
"tasks": [{
"label": "debuggertests",
"type": "npm",
"script": "test:unit",
"problemMatcher": []
}]
}
// package.json
// have to use jasmine-ts which is flavor over ts-node
"test:unit": "jasmine-ts JASMINE_CONFIG_PATH=spec/support/jasmine.json"
I have used this configuration to debug .spec.ts files in vscode but it did not fire debugger instead it run all tests and debugging started.
I have put a breakpoint in one of the test case of about.service.spec.ts but no breakpoint fired. Could anyone help me on setting up vscode debugging for jasmine tests?
In new jasmine-ts version, you have to include the jasmine.json to the args as this:
{
"type": "node",
"request": "launch",
"name": "Jasmine Current File",
"program": "${workspaceFolder}/node_modules/jasmine-ts/lib/index",
"args": ["--config=jasmine.json", "${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
To avoid this issue:
No specs found
Finished in 0.003 seconds
Incomplete: No specs found
Randomized with seed 60766 (jasmine --random=true --seed=60766)
Below configuration will debug current test file - please open the required test file in VS Code and start debugging with this configuration:
{
"type": "node",
"request": "launch",
"name": "Jasmine Current File",
"program": "${workspaceFolder}/node_modules/jasmine-ts/lib/index",
"args": ["${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
I've got a basic HelloWorld app based on the electron-hello-world project running on VSCode and able to launch a debug session and the app starts up fine.
I've got a breakpoint set on main.js but it appears to be greyed out with a message:
Breakpoint ignored because generated code not found (source map problem?)
Here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"program": "${workspaceRoot}/main.js",
"port": 9222,
"sourceMaps": true,
"diagnosticLogging": true,
"outFiles": [
"${workspaceRoot}"
]
}
]
}
Any help would be much appreciated.
If your generated code is present in "${workspace Root}" then outFiles should be "outFiles": [ "${workspaceRoot}/*.js" ].
For more info link