Reputation: 394
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.
Upvotes: 9
Views: 10885
Reputation: 2603
After verifying my launch.json
contents (as mentioned by @llotall and in several other places), I stopped and restarted VSCode (Chrome was already shutdown).
This fixed the problem for me.
Upvotes: 0
Reputation: 635
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.
Upvotes: 14
Reputation: 394
I solved the problem by updating some software:
Upvotes: 1