Markdown ファイルのプレビューを行おうとしたら、
Web ビューの読み込みエラー: Error: Could not register
service worksers: InvalidstateError: Failed to register a
ServiceWorker: The document is in an invalid state..
と出てきてらちがあかない。
調べるとWindows/Mac だとタスクを止めて vscode を立ち上げ直すという方法が紹介されていた。
Linux ではどうなのかな?
環境
- Ubuntu Linux 22.04 LTS
- Visual Studio Code 1.76.2
タスクを調べる
vscode のアクティブウィンドウをすべて閉じたあと、ps コマンドで調べてみる。
$ ps -auxww | grep vscode
nanbuwks 178488 0.0 0.1 33841700 66900 ? Sl 15:29 0:01 /usr/share/code/code --type=utility --utility-sub-type=network.mojom.NetworkService --lang=ja --service-sandbox-type=none --enable-crashpad --crashpad-handler-pid=178433 --enable-crash-reporter=67a756eb-25f9-4494-8506-26cecbe8a728,no_channel --user-data-dir=/home/nanbuwks/.config/Code --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --streaming-schemes --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,11318759198726841594,8649780044134260195,131072 --enable-features=AutoDisableAccessibility --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --enable-crashpad
nanbuwks 178520 0.3 0.3 52976104 231140 ? Sl 15:29 0:07 /usr/share/code/code --type=renderer --enable-crashpad --crashpad-handler-pid=178433 --enable-crash-reporter=67a756eb-25f9-4494-8506-26cecbe8a728,no_channel --user-data-dir=/home/nanbuwks/.config/Code --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --streaming-schemes --app-path=/usr/share/code/resources/app --no-sandbox --no-zygote --enable-blink-features=HighlightAPI --lang=ja --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=4 --launch-time-ticks=104614533287 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,11318759198726841594,8649780044134260195,131072 --enable-features=AutoDisableAccessibility --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --vscode-window-config=vscode:1cd2b928-7531-4e4d-bd84-445d679e1ea1 --enable-crashpad
nanbuwks 178628 0.8 0.2 46690124 149348 ? Sl 15:29 0:16 /usr/share/code/code --type=renderer --enable-crashpad --crashpad-handler-pid=178433 --enable-crash-reporter=67a756eb-25f9-4494-8506-26cecbe8a728,no_channel --user-data-dir=/home/nanbuwks/.config/Code --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --bypasscsp-schemes --cors-schemes=vscode-webview,vscode-file --fetch-schemes=vscode-webview,vscode-file --service-worker-schemes=vscode-webview --streaming-schemes --app-path=/usr/share/code/resources/app --no-sandbox --no-zygote --node-integration-in-worker --lang=ja --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=8 --launch-time-ticks=104615380867 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,11318759198726841594,8649780044134260195,131072 --enable-features=AutoDisableAccessibility --disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess --vscode-window-config=vscode:c07a24e4-cbbf-4025-a346-b406b28855cf --vscode-window-kind=shared-process --enable-crashpad
nanbuwks 188877 0.0 0.0 10268 2376 pts/2 S+ 16:01 0:00 grep --color=auto vscode
確かに、残ってますね。
タスク収量
$ pkill code
$ ps -auxww | grep vscode
nanbuwks 188902 0.0 0.0 10136 2204 pts/2 S+ 16:01 0:00 grep --color=auto vscode
復旧
動きました