tapio / live-server

A simple development http server with live reload capability.
http://tapiov.net/live-server/
4.41k stars 484 forks source link

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. #371

Open justingolden21 opened 3 years ago

justingolden21 commented 3 years ago

Issue description

Instead of reloading the page, I get this error:

(index):30 Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
    at refreshCSS (http://127.0.0.1:8080/docs/:30:11)
    at WebSocket.socket.onmessage (http://127.0.0.1:8080/docs/:44:40)

image

image

I added live-server to a project just fine, so I tried adding to another (same OS, same browser, same computer, same versions of everything)

I'm using this with tailwind (as I did on the other project that worked fine), and my scripts are limited to: window.onload = ()=> console.log('page loaded');

Software details

Thanks in advance 😄

justingolden21 commented 3 years ago

Completely off-topic, but while I'm here, in contributing.md, you could replace:

Does the naming (e.g. command line parameters) make sense and uses same style as other similar ones?

With:

Does the naming (e.g. command line parameters) make sense and use the same style as similar ones?

"use" instead of "uses," add "the", "other" is somewhat redundant to similar (unless you think "similar" could imply the same package which doesn't make sense in this context)

justingolden21 commented 3 years ago

I tried it in incognito and I don't get this issue, which makes me believe it's interacting with a browser extension weirdly, but the only thing that pops up under Sources in inspect element is "whatruns" and I've disabled that and all adblockers and it still has the same problem. It also works in firefox.

justingolden21 commented 3 years ago

It's worth nothing that I get that error anytime I change a file, so I don't have the error on page load, and if I change the file multiple times I'll get the error multiple times. This probably makes sense to the maintainers of this package, but thought it was worth a mention

justingolden21 commented 3 years ago

Similar errors:

https://github.com/tapio/live-server/issues/269

https://github.com/tapio/live-server/issues/5

Makes me think it's an extension issue but can't figure out which one. If this package doesn't work with a number of different popular extensions, which all work fine with other packages, I'd say it may be time to investigate how the code can be changed to error check before messing with the DOM. But idk anywhere close to as much about this as you guys do, so entirely your choice, just my two cents : )

justingolden21 commented 3 years ago

Found the issue was also with a dark mode extension (even though I tried removing it yesterday and it didn't work).

Is it possible to use some if statements for removing the links (just to check they're the ones created by live-server, assuming I understand how this works)?