问题
这个问题遇到好几次了,每次都得去搜一阵,这里记录一下.
使用MarkDown预览时,加载 Web 视图时出错: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state.
参考自 : stackover
原文:
In Windows, you can simply fix this error by clearing the cache for VSCode. Please follow the steps below:
-
Close VSCode and also kill any background processes running in the task manager. Task Manager screenshot
-
Go to the file explorer and to the path
C:\Users\<user_name>\AppData\Roaming\Code
and clear the contents of the folders
- Cache
- CachedData
- CachedExtensions
- CachedExtensionVSIXs (if this folder exists)
- Code Cache
- Open VSCode and you are good to go.