I had been successfully debugging my angular app in Chrome via Chrome Debugger extension with automatic created settings. But [something] happened, and after one of my Windows 7 reboots I got unactive breakpoints. I suppose that it was affected by Windows PATH environment variable change. Why I thinking so? I got a message like "PATH has a bad value, do you want to fix it?" when Windows started. Unfortunately I can't reproduce my old PATH value. It can be a coincidence, but after this case debugging does not work.
No matter where a breakpoints are set: neither in the beginning of function or code block, nor in the middle of block, nor in a variable declaration, nor a variable operations. Breakpoints is not activated in noone of angular components: neither root component, nor others.
I use Google Chrome latest version. Interestingly, I installed the Debugger for Electron extension, which also starts up successfully, but the breakpoints are still not activated.
Other info:
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}",
"trace": true,
"sourceMaps": true,
},
{
"type": "electron",
"request": "launch",
"name": "Launch Electron",
"sourceMaps": true,
"appDir": "H:/opened-in-VSCode-folder",
},
]
}
Project folder structure:
In launch.json also not works:
Additional reboots of Chrome, Windows, VSCode, reinstalling Angular and Electron don't leads to success. Antivirus stopped. Windows "Last successful login" did not help.
Thanks for any info.
UPD 1: The only word "error" in the vscode-chrome-debug.txt log file:
...
{"id":5,"result":{}} [09:54:38.267 UTC] ← From target:
{"error":{"code":-32601,"message":"'Runtime.run' wasn't found"},"id":6}
[09:54:38.267 UTC] ← From target:
...
UPD 2: Reinstalling windows not helped too. I guess the problem in the packages versions.
To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.
Ctrl + F8 (Mac: Cmd + F8) Toggle breakpoint. Ctrl + Shift + F8 (Mac: Cmd + Shift + F8) View breakpoints.
For me was problem in another. When you are added launch.json, you can see webRoot variable that has a value ${workspaceFolder} by default. Lets check what does it mean in this source
${workspaceFolder} - the path of the folder opened in VS Code
and in my case angular project was inside folder of another project and when i tried to debug i get breakpoint is set but not yet bound message.
And if you will open your angular project in VSCode explorer as root folder, your breakpoints will work.
Or if you don't want to open separate folder in VS Code explorer, you can specify in launch.json path to angular folder, like: ${workspaceFolder}/folder/folder/...
After this changes your debug should work.
I solved the problem by updating some software:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With