Why doesn't debugger stop at breakpoint?

39,778

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.
enter image description here

After I remove folder from workspace, breakpoint is ok!
enter image description here

Share:
39,778
user3389206
Author by

user3389206

Updated on July 26, 2022

Comments

  • user3389206
    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
    user3389206 over 10 years
    my 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
    Vishal Sharma over 10 years
    you 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
    Ognyan Dimitrov about 8 years
    Thsi is it. This happens when you add the working folder, containing the js to the chrome workspace after you opened the file.
  • Vadim
    Vadim almost 8 years
    Same for me. Removing file/folder from workspace fixed the issue.
  • Tobias Moe Thorstensen
    Tobias Moe Thorstensen almost 7 years
    Worked for me running VS Code. Thanks!
  • Black
    Black almost 3 years
    My 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
    Madbreaks over 2 years
    This 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.