17

I have breakpoints enabled on chrome dev tools and I have a breakpoint on a line. I know chrome is hitting the line because I put the breakpoint on a line that has the following statement: alert("why is this not breaking") The breakpoint works if I find the file in the localhost. The breakpoints used to function in the local editor but now they won't. Has anyone else had a similar problem?

ford prefect
  • 7,096
  • 11
  • 56
  • 83
  • Is this your own website or someone else's? Do you have some code to show where it's not breaking? – Cameron Tinker Dec 04 '13 at 20:46
  • 1
    Mine (that is to say for work) As far as code goes I know it's not code specific because as I said I stuck an alert statement in which evaluated but didn't stop at the breakpoint – ford prefect Dec 04 '13 at 20:47
  • Try clearing your cache and see if it breaks at the alert statement. – Cameron Tinker Dec 04 '13 at 20:48
  • @CameronTinker Just tried and it didn't break – ford prefect Dec 04 '13 at 20:49
  • Are you sure it's not from some conditional statement not being true? – Cameron Tinker Dec 04 '13 at 20:54
  • @CameronTinker What conditional statement? In my code? I am not sure what you mean – ford prefect Dec 04 '13 at 21:09
  • I've noticed Canary stopped breaking on breakpoints a few weeks ago. If you check in the stable channel, do breakpoints work there for you? – David Gilbertson Dec 06 '13 at 00:35
  • @DavidGilbertson I am afraid I am not sure what you mean by check in the stable channel? – ford prefect Dec 06 '13 at 14:14
  • @inquisitiveIdiot There are four versions of Chrome available at any one time. Stable, Beta, Development and Canary. Canary is updated the most frequently and often has bugs (that's the idea). If a problem occurs in canary, but not stable, then you just need to wait it out until the issue is fixed. More: http://www.chromium.org/getting-involved/dev-channel – David Gilbertson Dec 07 '13 at 06:34
  • Use something that doesn't come from Google and your life will become much more interesting. – luke1985 Dec 09 '13 at 16:03
  • @lukasz1985 someone recommended Tincr... are you against this? – ford prefect Dec 09 '13 at 17:02
  • @inquisitiveIdiot I woud recommend Netbeans IDE for web development. It seems to greatly ease the pain of CSS editing. The key is the Project Easel which allows to preview changes realtime. It also supports debugging JS from inside the editor. It has integrated webkit browser and allows integration with Chrome. Personally I see no other good tool for this. Here is a screencast: https://netbeans.org/kb/docs/web/html5-gettingstarted-screencast.html – luke1985 Dec 09 '13 at 18:16

4 Answers4

20

I had a similar problem not hitting my breakpoints. Turned out it was because it was a deployed version of the site but the dev tools still had my local dev folder mapped to the workspace, the meant I had the local script files open not the ones on the server. The solution was to close the opened local scripts, opening the right files in the navigator and then setting the breakpoints.

OK I was a bit dumb not realising it in the first place, but this might serve as a good note for anyone else having the same problem as me.

baralong
  • 1,644
  • 1
  • 16
  • 32
  • 2
    Well not so dumb because the same happened to me :-) – PeeWee2201 Oct 08 '15 at 14:19
  • Also consider mapping the local source file to its corresponding network resource. Right-click on the local file (e.g. index.html) in the dev tools sources navigator and select map to network resource. Now breakpoints and local editing will work properly. You can see and edit file mappings in Dev Tools Settings - Workspace. – Philip Murphy Jun 01 '16 at 16:12
2

Should anyone stumble across this later. I have yet to find a definitive answer to this question but these are some other where I have found some helpful info:

Chrome developer tools workspace mappings

Chrome Stable/Canary Dev Tools Issues - Syntax Highlighting Auto-Complete etc

I will continue to update this should I find a real solution

The accepted answer is correct here.

Community
  • 1
  • 1
ford prefect
  • 7,096
  • 11
  • 56
  • 83
  • 2
    This just happened to me. Removing folder from workspace and redoing the mapping allowed breakpoints to start triggering again. – Renaud Jun 26 '15 at 14:34
1

The debugger; tip in Chrome javascript debugger breakpoints don't do anything? helped me find where my mistake was.

I'm working on a Rails project for the first time, and there were two versions of the file without my knowing it. Rails' "asset pipeline" used a //= require foo statement to import, and the same foo file was also included somewhere else.

The debugger; pointed me to the right place, thankfully.

Community
  • 1
  • 1
Ben
  • 54,723
  • 49
  • 178
  • 224
0

You should enable the setting to stop on any exception, in the Sources tab on the developer page (F12 in chrome). (Unload your other extensions to help focus only on the problem one, and remove their thumbnails on the left panel too).

There may be an exception thrown earlier than any debug breakpoint you have set. E.g. there if there is a missing extension permission requirement in the manifest file, which causes an exception to be thrown once it tries to use the resource but can't.

Markus
  • 1,020
  • 14
  • 18