I'm working on a Javascript project and using the Chrome F12 Developer Tools for debugging. For some reason all the console.log outputs and error messages claim that they are occuring on line 1 of my js file.
...i.e., in the Console to the right of each line it says myFile.js:1
even though there is no code on line 1, and the code is obviously running on a different line.
What could be the cause of this?
Apparently other people weren't able to reproduce the problem (@Bergi), so I can only imagine that Chrome was somehow having a problem with the file (corrupted?). Clearing cache did not help.
The work-around solution that worked for me was to use a new file.
The new js file now displays the correct line numbers. Despite all properties looking the same and all text content being the same, the new file had about 100 more bytes than the original broken file.
Hopefully this helps someone who has the same issue, and hopefully the root problem is one day discovered and fixed. (Error reproduced by me in Chrome versions 34.0.1847.116 m and 34.0.1847.131 m)
This sounds like an issue where the line endings aren't in the correct format. It could be an issue with the settings being used by your editor, or even an issue with the way the file was copied to the server. But for whatever reason, the lines aren't being recognized as having correctly encoded endings, so it's all being seen as one line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With