Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Dev Tools hitting code but not breakpoints

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?

like image 299
ford prefect Avatar asked Dec 04 '13 20:12

ford prefect


3 Answers

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.

like image 135
baralong Avatar answered Nov 03 '22 23:11

baralong


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.

like image 38
Ben Avatar answered Nov 03 '22 23:11

Ben


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.

like image 43
ford prefect Avatar answered Nov 03 '22 23:11

ford prefect