简体   繁体   English

运行 VS Code Live Server (Go Live) 时,浏览器崩溃。 我默认使用谷歌浏览器

[英]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 和您的浏览器都非常好(它们只出现不工作):

  1. No need to restart or reinstall VS Code.无需重新启动或重新安装 VS Code。
  2. No need to restart or reinstall browser.无需重新启动或重新安装浏览器。
  3. No need to restart the PC无需重启电脑
  4. No need to disable browser extensions or VS Code extensions.无需禁用浏览器扩展或 VS Code 扩展。
  5. No need to change LiveServer Custom Browser;无需更改 LiveServer 自定义浏览器; you can keep it default.你可以保持默认。
  6. No need to change LiveServer>Settings>Use local ip or Use browser preview (you can keep them both unchecked if they are already unchecked by default)无需更改 LiveServer>Settings>Use local ip 或使用浏览器预览(如果默认情况下已经取消选中它们,则可以保持它们都未选中)

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.

相关问题 为什么VS code live server打开一个目录而不是在浏览器中运行代码? - Why is VS code live server opening a directory instead of running the code in the browser? 为什么我在使用 VS Code 和 Live Server 时不断收到控制台错误? - Why do I keep getting a console error when using VS Code and Live Server? CSS 未保存在 Live Server 中(VS CODE) - CSS not saving in Live Server (VS CODE) 动作标签在实时服务器与代码中不起作用 - The action tag is not working in live server vs code 实时服务器已安装但无法在 VS 代码中运行 - Live server installed but not working in VS code js代码在控制台中运行但不是由实时服务器运行 - js code running in console but not by live server 使用带麦克风的 Google Chrome Live Captioning - using Google Chrome Live Captioning with microphone 在 Visual Studio Code 中编码时如何阻止实时服务器自动打开浏览器? - How to stop live-server opening the browser automatically while coding in Visual Studio Code? html 文件中的 javascript 在我使用 VS Code 的实时服务器中工作正常,但如果我在本地打开 .html 文件,它就不起作用 - javascript in a html file works fine in my live server using VS Code but if i open the .html file locally it doesn't work Live Server 与 Lite Server - Live Server vs Lite Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM