エラーが起こったコード
PowerShell
wsl --install
エラー内容
PowerShell
Wsl/InstallDistro/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE
エラーの意味
これは「WSL用の仮想マシン(VM)を作るサービスが動いていません」という意味です。
##解決策
手順1 PowerShellを管理者として実行
スタート →「PowerShell」と検索
**「管理者として実行」**を選ぶ
手順2 コマンドを1つずつ入力
PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
PowerShell
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
手順3 再起動する
手順4 再起動後に再び以下を実行
PowerShell
wsl --install