The Chrome console gives me the line number from the beginning of <script> and not up

This has been undermining me for a while. At some point, my Chrome console started logging the line number from the beginning of my JS <script> , and not from the top of the file. I think I could change something, as it was done the other way around.

In this example, Chrome returns "hello" as being on line 20 (270-250 = 20), rather than 270, as it were.

 <html> - line 1 ... <script> - line 250 ... console.log('hello') - line 270 

Unfortunately, this made this useful feature almost useless. Has anyone experienced this?

+4
source share
2 answers

Try updating your version of Chrome. It works great for me, at least in Chrome 22 and later. If you still fail, you can create a new error at http://new.crbug.com , its summary starts with "DevTools:". In addition, providing a publicly available test case will drastically reduce the number of errors and research time (remember that a simplified case worked for me in Chrome 22!)

+1
source

This is an old question, so I don’t know if it will help, but I found this while trying to solve another Chrome Devtools error.

I have run into this problem lately, and it seems that something can happen to the file (corruption?) That prevents Chrome from correctly reading line breaks. In my case, it was reported that all console.log () came from a line: 1. After pulling my hair out for some time, the only solution I found was to rename the damaging file, create a new file with the original file name, and then pasting all the code into a new file. console.log () should now report on the correct line numbers.

0
source

Source: https://habr.com/ru/post/1434313/


All Articles