Вопрос

All of a sudden, my breakpoints in Chrome stopped working entirely. The weird thing is if I hit an error in the code and break that way, or if I add debugger; anywhere in my code, it does stop, but it opens a different file with a prefix like VM[number].

The file that shows naturally in the development console that breakpoints don't work in is entitled main.js, but when I encounter an error or stop through the debugger command, it opens a new file called "VM113 main.js". The even weirder thing is if I follow the code into a different file, like jquery.js, it also doesn't go into the jquery.js file but into a file called "VM97 jquery.js" or "VM98 jquery-ui.js".

What's going on and how do I get Chrome to look at the actual files rather than VM files?

Это было полезно?

Решение 2

I completely uninstalled Chrome and reinstalled it and that seemed to fix the issue. I do not know what caused it to start this behavior, but a reinstall solved it.

Другие советы

In my personal research, this is caused by having an accented character in the file path of the file in which I'm attempting to place a breakpoint.

Suppose you have two files, HäagenDazs/main.js and HaagenDazs/main.js (named for the sake of example) and they both contain (roughly) the same thing:

var x = function () {}; and var y = function () {};

If you place a breakpoint in HäagenDazs/main.js, Chrome will delete it and set it in VM-### main.js at the same location. If you place a breakpoint in HaagenDazs/main.js, Chrome keeps it there in the original file.

It seems to be the combination of an accented character anywhere in the path and having the keyword function present in that file. I tested this in OS X 10.10 using Chrome Version 38.0.2125.122.

I've just experienced the same issue and got a solution, so I'll leave it here just for the record.

In my case, it was because that particular website used service workers, and they provided an additional level of JS caching 'ahead' of the local overrides where I had placed my breakpoints.

So the execution always stopped in a [VM] tab that did not contain any of the changes that I had in those overrides.

The solution was to go into the Application menu. There, in the Service Workers section, I checked the 'Offline' and 'Bypass for network' options, then clicked on 'Unregister' on the far right side.

Chrome development console screenshot: the Application menu

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top