winget-cli
winget-cli copied to clipboard
Winget Client Powershell cmdlets - Unable to find installation package error
Brief description of your issue
When trying to run the Install-WinGetPackage commandlet, I encounter various error messages relating to arguments being determined as null as seen in the snippet below. This also occurs for Uninstall-WinGetPackage. Looks like there's an issue relating to feeding in the arguments to the Find-WinGetPackage powershell script.
Install-WinGetPackage -Id Microsoft.Powertoys
You cannot call a method on a null-valued expression.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:91 char:13
+ $WinGetArgs += "--Name", $Name.Replace("…", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:95 char:13
+ $WinGetArgs += "--Moniker", $Moniker.Replace("…", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:99 char:13
+ $WinGetArgs += "--Tag", $Tag.Replace("…", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:103 char:13
+ $WinGetArgs += "--Command", $Command.Replace("…", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:111 char:13
+ $WinGetArgs += "--Source", $Source.Replace("…", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Invoke-WinGetCommand : Cannot bind argument to parameter 'WinGetArgs' because it is an empty string.
At C:\Users\ryfu\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Library\Find-WinGetPackage.ps1:132 char:50
+ $List = Invoke-WinGetCommand -WinGetArgs $WinGetArgs -IndexTi ...
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-WinGetCommand], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Invoke-WinGetCommand
Steps to reproduce
- git clone winget repository
- Run command in powershell
Import-Module C:\git\winget-cli\tools\PowerShell\Microsoft.WinGet.Client\src\Microsoft.WinGet.Client.psm1
- Restart powershell and run
Install-WinGetPackage -Id Microsoft.Powertoys
Expected behavior
It should install Microsoft.Powertoys
Actual behavior
Shows error and reports:
Unable to locate package for installation
Environment
Windows Package Manager v1.1.12653
Windows: Windows.Desktop v10.0.22515.1000
Package: Microsoft.DesktopAppInstaller v1.16.12653.0