Skip to content
Latchkey

Windows "winget is not recognized" / not available on runner in CI

winget was invoked but is not available. winget ships with the App Installer and depends on a user/desktop context that headless CI runners often lack, so it is frequently missing or non-functional.

What this error means

Calling winget fails with CommandNotFoundException, or it is present but errors about no logged-on user. Deterministic for a given image.

powershell
winget : The term 'winget' is not recognized as the name of a cmdlet, function,
script file, or operable program.
    + FullyQualifiedErrorId : CommandNotFoundException

Common causes

App Installer is not provisioned for the runner user

winget comes from the App Installer MSIX package, which may not be registered for the non-interactive runner account, so the command does not resolve.

winget needs a desktop/user context it lacks

Even when installed, winget can fail in a headless session that has no interactive user profile.

How to fix it

Use Chocolatey instead

choco is preinstalled on Windows runners and works headless, so prefer it for CI installs.

cmd
choco install mytool -y --no-progress

Register the App Installer if winget is required

Register the MSIX so winget resolves for the current user, then retry.

powershell
Add-AppxPackage -RegisterByFamilyName -MainPackage `
  Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
winget --version

How to prevent it

  • Prefer Chocolatey for headless Windows CI installs; only use winget when you can guarantee the App Installer is provisioned for the runner account.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →