Why doesn't debugger stop at breakpoint?
Solution 1
Without a clear reproduction plan, it is very hard to tell why your breakpoints are not hitting.
But, one surest way of stopping on a line is writing:
debugger;
to the location where you want to stop. Without any blue signs on the gutter, the debugger will halt.
NOTE: Be sure to clear all the debugger;
when you are done with it.
More info is here
Solution 2
What I found worked was to set my breakpoints using the suggestions above, then in the extension's console run:
location.reload(true);
This re-opens the extensions, set off my breakpoints and allowed me to debug!
It appears that the problem is related to the debugger loading after the extension, thus not capturing the breakpoints. Hope that helps!
Solution 3
I had an issue with breakpoints being hit that I just resolved. Breakpoints within javascript in the html were not being hit, although I could set and hit breakpoints in included Javascript files.
I found that the problem was that the source file was included twice. The base html page (not dynamically included) has the sourceURL tag in it. This caused the same javascript to exist twice in the source pane, causing the issue.
I removed the "sourceURL" tag from the base html page, and breakpoint resumed working
Solution 4
For me this appears to be a bug in chrome - nothing would cause a breakpoint to be hit, not even debugger
. I had to close and re-open Chrome, and then my breakpoints worked.
Solution 5
Here is how I solve it.
Because I did add folder to workspace.
And then, devTool breakPoint doesn't work.
After I remove folder from workspace, breakpoint is ok!
user3389206
Updated on July 26, 2022Comments
-
user3389206 almost 2 years
I have the problem that the chrome debugger for JS doesn't stop every time I execute one certain function. I tried debugger; and also setting breakpoints where I want the code to stop by putting a blue tag on the gutter next to the line on the left.
any ideas why this happens?
-
user3389206 over 10 yearsmy problem is not that it won't ever stop at the breakpoint, it is that in the first run it doesn't, which is the most important.. after the first time it works perfectly fine.. but thats too late
-
Vishal Sharma over 10 yearsyou can set condition by right clicking on breakpoint and edit breakpoint , set condition that always evaluates to true like 1 == 1 .. check and reply
-
Ognyan Dimitrov about 8 yearsThsi is it. This happens when you add the working folder, containing the js to the chrome workspace after you opened the file.
-
Vadim almost 8 yearsSame for me. Removing file/folder from workspace fixed the issue.
-
Tobias Moe Thorstensen almost 7 yearsWorked for me running VS Code. Thanks!
-
Black almost 3 yearsMy chrome still ignores it and does nothing, even though I log a text with console.log before i call
debugger
and that text is getting logged. -
Madbreaks over 2 yearsThis might be helpful if you're in a position to modify the source but in general it is not a solution to op's question.