[英]While running VS Code Live Server (Go Live), the browser is crashing. I am using Google Chrome as default
While running VS Code Live Server (Go Live), the browser is crashing with the below mentioned error.运行 VS Code Live Server (Go Live) 时,浏览器崩溃并出现以下错误。 I am using Google Chrome as default.
我默认使用谷歌浏览器。 I re-installed VS Code after uninstalling completely (from cache even), restarted browser, and then restarted PC as well with no use.
我在完全卸载(甚至从缓存中)后重新安装了 VS Code,重新启动了浏览器,然后也重新启动了 PC,但也没有用。 When I checked "Use Local Ip" in LiveServer>Settings:, server is taking too long to respond and eventually fails to load the page (Error: " This site can't be reached ").
当我在 LiveServer>Settings: 中选中“使用本地 IP”时,服务器响应时间过长,最终无法加载页面(错误:“无法访问此站点”)。 Another important thing is that Chrome is opening every other website properly.
另一个重要的事情是 Chrome 正在正确打开所有其他网站。 This problem exists only when opening VS Code Live Server.
此问题仅在打开 VS Code Live Server 时存在。 Below is the error code:
下面是错误代码:
Chrome Browser Error: " Aw, Snap. Something went wrong while displaying this webpage: Error code: STATUS_BREAKPOINT " Chrome 浏览器错误:“哦,快。显示此网页时出现问题:错误代码:STATUS_BREAKPOINT ”
Another popup is also showing up simultaneously: " DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect. "另一个弹窗也同时出现:“ DevTools 与页面断开连接。一旦页面重新加载,DevTools 将自动重新连接。 ”
(This didn't seem like a bug in the code of script.js) (这似乎不是 script.js 代码中的错误)
Found the Solution:找到解决方案:
Indeed it is a bug in the code of script.js.事实上,这是 script.js 代码中的一个错误。 If you are having exactly the same problem as I described , let us first see what we don't need to do, as I found these suggestions everywhere, and none will work when both VS Code and your browser are perfectly fine (they only appear to be not working):
如果您遇到与我描述的完全相同的问题,让我们首先看看我们不需要做什么,因为我到处都发现了这些建议,当 VS Code 和您的浏览器都非常好(它们只出现不工作):
However, if you use firefox, console shows the error: " Uncaught out of memory "但是,如果您使用 firefox,控制台会显示错误:“ Uncaught out of memory ”
Here, I got the first hint.在这里,我得到了第一个提示。 Firefox at least told me to look at memory, but it is not about the memory we think.
Firefox至少告诉我看memory,但不是我们认为的memory。 It is not about multiple tabs opened, lack of disk space, unstable disk, etc. It is the accidentally generated infinite loop in the code which is causing the memory problem (check your code carefully to find it).
这与打开多个选项卡、磁盘空间不足、磁盘不稳定等无关。而是代码中意外生成的无限循环导致了 memory 问题(仔细检查您的代码以找到它)。 In my case, I accidentally didn't tell it to execute the next iteration (ie, missing counter update, increment, i++) and it is stuck in the same while loop forever, as the condition is satisfied forever without any counter update .
就我而言,我不小心没有告诉它执行下一次迭代(即缺少计数器更新、增量、i++)并且它永远停留在同一个while循环中,因为条件永远满足而没有任何计数器更新。
After fixing the code, the below error might show up in the console.修复代码后,控制台中可能会显示以下错误。 Just refresh the page and it will go away.
只需刷新页面,它就会 go 消失。 " favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found) "
“ favicon.ico:1 加载资源失败:服务器响应状态为 404(未找到) ”
Note: Unless you fix the code or comment it out, other linked files (like.html) in the folder wouldn't work either.注意:除非您修复代码或将其注释掉,否则文件夹中的其他链接文件(如 .html)也不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.