This is my first time use debugger on Visual Studio Code. I am working on a asp.net-react webapi. I was easily able to use debugger for .net Core. Here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/API/bin/Debug/net6.0/API.dll",
"args": [],
"cwd": "${workspaceFolder}/API",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\bNow listening on:\s+(https?://\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
Then I wanted to use debugger for node. I watched some videos from youtube but none of them worked. I also followed this link https://code.visualstudio.com/docs/editor/debugging, followed his steps but I nothing worked. I tried on launch, on attach, but the debugger doesn't even start. I added a onlaunch configuration:
{
"name": "Launch Program",
"program": "${workspaceFolder}/app.js",
"request": "launch",
"skipFiles": [ "<node_internals>/**" ],
"type": "node"
},
and it threw me this error on debug console:
C:\Program Files\nodejs\node.exe .\app.js
Process exited with code 1 Uncaught Error
Error: Cannot find module
'c:\Users\Lenovo\Desktop\Student\app.js' at
Module._resolveFilename (internal/modules/cjs/loader:933:15) at
Module._load (internal/modules/cjs/loader:778:27) at
executeUserEntryPoint (internal/modules/run_main:77:12) at
(internal/main/run_main_module:17:47)
No debugger available, can not send 'variables'
When I use onattach configuration:
{
"name": "Attach",
"port": 3000,
"request": "attach",
"skipFiles": [ "<node_internals>/**" ],
"type": "node"
},
it doesn't even throw any error, nor start debugging.
I googled and tried so many ways and nothing worked. Can anybody explain what should I do.
Thank you.