Pregunta

In Chrome's console (Tools » Developer Tools) the script I'm debugging is showing up without linebreaks even though the actual file has them. This has happened to me before, but I can figure out if it's something with the spaces in the file or a setting in Chrome. But it's pretty impossible to debug something when every error comes up as being on line 1. I tried restarting Chrome but no dice. Any idea how to get it back to normal?

¿Fue útil?

Solución

Open your file with Notepad or some other editor and save it again. It seems like you ran into the same problem as the one mentioned here.

http://196.23.168.153/support/forum/p/Chrome/thread?tid=0936a4d8f8b915b5&hl=en

If that doesn't work, use the pretty print button :-)

Otros consejos

It sounds like the file has been minified. Do you know if it's run through any kind of build process before you're looking at it?

If not, I'm not sure exactly why that might be happening. There is a halfway decent workaround:

Open the script in the Scripts tab, and click the {} prettyprint button at the bottom to restore the formatting. It's kind of annoying to have to do that all the time, though.

Is there a public link we could see? I can imagine that there might be some line-ending issues if the file was created on one platform (Mac/Linux/Windows) and is being viewed on another. Haven't run into this one myself yet.

I had this problem and it was the EOL line endings. I changed them from Mac Classic (\n) to Windows Dos (\n\r).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top