Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 314
yiwanmian Avatar asked May 26 '21 03:05

yiwanmian


2 Answers

If you are using Ubuntu, there is probably another (maybe hidden) vscode process, which is causing the problem.

Try killall code.

like image 76
yavorbel Avatar answered Oct 17 '22 09:10

yavorbel


I encountered this issue and am not a Windows user, so this is my resolution:

I found that there was an instance of VS Code open that was erroneously not shown on my dock. I closed this instance and opened a new instance. The problem was gone.

I think the issue happened because I had a VS Code instance open, allowed a software update to run in the background, postponed the restart, opened a new and updated VS Code instance, and the old instance remained open causing conflicts.

OS: Ubuntu 20.04.2 LTS

like image 94
Sydney Y Avatar answered Oct 17 '22 11:10

Sydney Y