永久解决vscode加载Web视图时出错

4,570 阅读1分钟

vscode插件打不开的情况,相信遇到过的都不陌生

加载 Web 视图时出错: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state…

在vscode/cursor出现以上报错后,我浅浅地搜了以下解决方案 code --no-sandbox 然后就执行了,然后后续问题又继续出现了。

为了一劳永逸的解决这个问题,我找到那个配置项。

根据官方的更新说明,配置方式如下:

  • Open the Command Palette (Ctrl+Shift+P).
    打开命令调板(Ctrl+Shift+P)。

  • Run the Preferences: Configure Runtime Arguments command.
    运行 首选项:配置运行时参数命令。

  • This command opens a argv.json file to configure runtime arguments. You might see some default arguments there already.
    此命令将打开 argv.json 文件,以配置运行时参数。您可能已经在该文件中看到了一些默认参数。

  • Add "disable-chromium-sandbox": true.  添加 "disable-chromium-sandbox": true 。

  • Restart VS Code.  重新启动 VS 代码。

参考v1.8更新说明: code.visualstudio.com/updates/v1_…