Search code examples
visual-studio-code

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope


When I update my VSCode to v1.56.2 and open webview, I get these messages:

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope ('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/') with script ('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/service-worker.js?platform=electron&id=867f875b-c5a3-4504-8de2-2e8614bdc0f8&vscode-resource-origin=https%3A%2F%2F867f875b-c5a3-4504-8de2-2e8614bdc0f8.vscode-webview-test.com'): ServiceWorker cannot be started.

How can I solve this issue?


Solution

  • This is a known bug in VS Code 1.56. It happens for some Windows users when running VS Code as an administrator

    As a workaround, you can try launching VS Code with the --no-sandbox command line flag:

    $ code --no-sandbox