最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Chrome Dev Tools hitting code but not breakpoints - Stack Overflow

programmeradmin1浏览0评论

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?

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?

Share Improve this question asked Dec 4, 2013 at 20:43 ford prefectford prefect 7,38811 gold badges58 silver badges85 bronze badges 12
  • Is this your own website or someone else's? Do you have some code to show where it's not breaking? – Cameron Tinker Commented Dec 4, 2013 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 Commented Dec 4, 2013 at 20:47
  • Try clearing your cache and see if it breaks at the alert statement. – Cameron Tinker Commented Dec 4, 2013 at 20:48
  • @CameronTinker Just tried and it didn't break – ford prefect Commented Dec 4, 2013 at 20:49
  • Are you sure it's not from some conditional statement not being true? – Cameron Tinker Commented Dec 4, 2013 at 20:54
 |  Show 7 more comments

4 Answers 4

Reset to default 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.

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.

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.

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.

发布评论

评论列表(0)

  1. 暂无评论