marticliment / UniGetUI

UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers
https://www.marticliment.com/unigetui/
MIT License
13.31k stars 460 forks source link

[BUG] Scope issue when upgrading Microsoft.WinGet.Client via Powershell #2995

Open beecho01 opened 3 days ago

beecho01 commented 3 days ago

Please confirm these before moving forward

UniGetUI Version

3.1.3

Windows version, edition, and architecture

Windows 11 Pro 1000.22700.1041.0 x64

Describe your issue

When attempting to upgrade Microsoft.WinGet.Client I get the error:

Starting package update operation for package id=Microsoft.WinGet.Client with Manager name=PowerShell
Given installation options are <InstallationOptions: SkipHashCheck=False;InteractiveInstallation=False;RunAsAdministrator=True;Version=;Architecture=;InstallationScope=;InstallationScope=;CustomParameters=;RemoveDataOnUninstall=False>
Process Executable     : C:\Program Files\WingetUI\Assets\Utilities\gsudo.exe
Process Call Arguments : "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"  -NoProfile -Command Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force  -Scope CurrentUser
Working Directory      : C:\Users\<redacted>
Process Start Time     : 19/11/2024 00:10:22
Update-Module : A parameter cannot be found that matches parameter name 'Scope'.
At line:1 char:68
+ ... e -Name Microsoft.WinGet.Client -Confirm:$false -Force -Scope Current ...
+                                                            ~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Update-Module], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Update-Module
Process Exit Code      : 1
Process End Time       : 19/11/2024 00:10:23

I believe that the update-module does not support -Scope for Powershell 5.0 as per the link here: https://learn.microsoft.com/en-us/previous-versions/powershell/module/powershellget/update-module?view=powershell-5.0

Steps to reproduce the issue

Attempt to upgrade Microsoft.WinGet.Client via Package Manager: PowerShell 5.x: PSGallery using the default installation options.

UniGetUI Log

[19/11/2024 00:00:02]    __  __      _ ______     __  __  ______
                        / / / /___  (_) ____/__  / /_/ / / /  _/
                       / / / / __ \/ / / __/ _ \/ __/ / / // /
                      / /_/ / / / / / /_/ /  __/ /_/ /_/ // /
                      \____/_/ /_/_/\____/\___/\__/\____/___/
                          Welcome to UniGetUI Version 3.1.3
[19/11/2024 00:00:02]
[19/11/2024 00:00:02] Version Code:  3.13001
[19/11/2024 00:00:02] Encoding Code Page set to 850
[19/11/2024 00:00:03] Using bundled GSudo at C:\Program Files\WingetUI\Assets\Utilities\gsudo.exe
[19/11/2024 00:00:03] Loaded language locale: en
[19/11/2024 00:00:04] An error occurred while initializing the API
[19/11/2024 00:00:04] Nancy.Hosting.Self.AutomaticUrlReservationCreationFailureException: The Nancy self host was unable to start, as no namespace reservation existed for the provided url(s).

                      Please either enable UrlReservations.CreateAutomatically on the HostConfiguration provided to 
                      the NancyHost, or create the reservations manually with the (elevated) command(s):

                      netsh http add urlacl url="http://+:7058/" user="Everyone"

                         at Nancy.Hosting.Self.NancyHost.StartListener()
                         at Nancy.Hosting.Self.NancyHost.Start()
                         at UniGetUI.Interface.BackgroundApiRunner.Start() in C:\SomePrograms\WingetUI-Store\src\UniGetUI.Interface.BackgroundApi\BackgroundApi.cs:line 72
[19/11/2024 00:00:04] Lang files were updated successfully from GitHub
[19/11/2024 00:00:04] UniGetUI is up to date
[19/11/2024 00:00:05] Downloaded new icons and screenshots successfully!
[19/11/2024 00:00:06] Command cargo was not found on the system
[19/11/2024 00:00:06] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Cargo
                      █ Enabled: True
                      █ Found: False
                      █ THE MANAGER WAS NOT FOUND. PERHAPS IT IS NOT 
                      █ INSTALLED OR IT HAS BEEN MISCONFIGURED 
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:06] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Winget
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: winget.exe
                      █ Executable path: C:\Users\<redacted>\AppData\Local\Microsoft\WindowsApps\winget.exe
                      █ Call arguments: 
                      █ Version: 
                      █   System WinGet CLI Version: v1.9.25180
                      █   Using Native WinGet helper (COM Api)
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:06] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: .NET Tool
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: dotnet tool
                      █ Executable path: C:\Program Files\dotnet\dotnet.exe
                      █ Call arguments: tool
                      █ Version: 
                      █   8.0.404
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:06] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Npm
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: npm
                      █ Executable path: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
                      █ Call arguments:  -NoProfile -ExecutionPolicy Bypass -Command npm
                      █ Version: 
                      █   10.9.0
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:06] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Pip
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: pip
                      █ Executable path: C:\Python312\python.exe
                      █ Call arguments:  -m pip
                      █ Version: 
                      █   pip 24.3.1 from C:\Python312\Lib\site-packages\pip (python 3.12)
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:06] Starting scoop cleanup...
[19/11/2024 00:00:07] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Scoop
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: scoop
                      █ Executable path: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
                      █ Call arguments:  -NoProfile -ExecutionPolicy Bypass -Command scoop
                      █ Version: 
                      █   Current Scoop version:
                      █   859d1db5 chore(release): Bump to version 0.5.2 (#6080)
                      █   
                      █   'main' bucket:
                      █   e8608e629 watchman: Update to version 2024.11.18.00
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:08] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: PowerShell
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: powershell.exe
                      █ Executable path: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
                      █ Call arguments:  -NoProfile -Command
                      █ Version: 
                      █   Name                           Value                                                                                   
                      █   ----                           -----                                                                                   
                      █   PSVersion                      5.1.22621.4249                                                                          
                      █   PSEdition                      Desktop                                                                                 
                      █   PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
                      █   BuildVersion                   10.0.22621.4249                                                                         
                      █   CLRVersion                     4.0.30319.42000                                                                         
                      █   WSManStackVersion              3.0                                                                                     
                      █   PSRemotingProtocolVersion      2.3                                                                                     
                      █   SerializationVersion           1.1.0.1
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:08] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: Chocolatey
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: choco.exe
                      █ Executable path: C:\Users\<redacted>\AppData\Local\UniGetUI\Chocolatey\choco.exe
                      █ Call arguments: 
                      █ Version: 
                      █   This is try 1/3. Retrying after 400 milliseconds.
                      █    Error converted to warning:
                      █    Access to the path 'C:\ProgramData\chocolatey\config\chocolatey.config.26976.update' is denied.
                      █   This is try 2/3. Retrying after 600 milliseconds.
                      █    Error converted to warning:
                      █    Access to the path 'C:\ProgramData\chocolatey\config\chocolatey.config.26976.update' is denied.
                      █   Maximum tries of 3 reached. Throwing error.
                      █   2.2.2
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:08] ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                      █▀▀▀▀▀▀▀▀▀▀▀▀▀ MANAGER LOADED ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                      █ Name: PowerShell7
                      █ Enabled: True
                      █ Found: True
                      █ Fancy exe name: pwsh.exe
                      █ Executable path: C:\Program Files\PowerShell\7\pwsh.exe
                      █ Call arguments:  -NoProfile -Command
                      █ Version: 
                      █   PowerShell 7.4.6
                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
[19/11/2024 00:00:08] LoadComponentsAsync finished executing. All managers loaded. Proceeding to interface.
[19/11/2024 00:00:09] Resetting administrator rights cache for process id 20120
[19/11/2024 00:00:09] Scoop cleanup finished!
[19/11/2024 00:00:10] Found 0 available updates from Chocolatey
[19/11/2024 00:00:11] Found 10 installed packages from Scoop
[19/11/2024 00:00:12] Dependency Scoop-Search for manager Scoop is present
[19/11/2024 00:00:12] Ignored updates database was never loaded, so it is going to be loaded now
[19/11/2024 00:00:12] Dependency Git for manager Scoop is present
[19/11/2024 00:00:13] Found 0 installed packages from PowerShell7
[19/11/2024 00:00:13] Dependency .NET Tools Outdated for manager .NET Tool is present
[19/11/2024 00:00:13] Found 150 installed packages from Pip
[19/11/2024 00:00:14] Found 1 installed packages from PowerShell
[19/11/2024 00:00:14] Found 3 installed packages from Npm
[19/11/2024 00:00:14] Found 0 available updates from .NET Tool
[19/11/2024 00:00:14] Found 0 available updates from PowerShell7
[19/11/2024 00:00:14] Found 1 available updates from Npm
[19/11/2024 00:00:14] Found 1 installed packages from .NET Tool
[19/11/2024 00:00:15] Found 10 installed packages from Scoop
[19/11/2024 00:00:15] Found 1 available updates from PowerShell
[19/11/2024 00:00:15] Found 0 installed packages from Chocolatey
[19/11/2024 00:00:16] Found 310 installed packages from Winget
[19/11/2024 00:00:16] Found 0 available updates from Scoop
[19/11/2024 00:00:18] Found 15 available updates from Winget
[19/11/2024 00:00:29] Found 24 available updates from Pip
[19/11/2024 00:01:02] Loaded operation parameters for package id=Microsoft.WinGet.Client on manager PowerShell and operation Update: Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force  -Scope AllUsers
[19/11/2024 00:01:02] An error occurred while retrieving the icon for package Microsoft.WinGet.Client
[19/11/2024 00:01:02] System.ArgumentOutOfRangeException: startIndex ('-1') must be a non-negative value. (Parameter 'startIndex')
                      Actual value was -1.
                         at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
                         at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
                         at System.String.Substring(Int32 startIndex, Int32 length)
                         at UniGetUI.Core.IconEngine.IconCacheEngine.GetCacheOrDownloadIcon(Nullable`1 _icon, String ManagerName, String PackageId) in C:\SomePrograms\WingetUI-Store\src\UniGetUI.Core.IconStore\IconCacheEngine.cs:line 89
                         at UniGetUI.PackageEngine.PackageClasses.Package.LoadIconUrlIfAny() in C:\SomePrograms\WingetUI-Store\src\UniGetUI.PackageEngine.PackageManagerClasses\Packages\Package.cs:line 200
[19/11/2024 00:01:29] Found 0 screenshots for package Id=Microsoft.WinGet.Client
[19/11/2024 00:01:29] Loaded details for package Microsoft.WinGet.Client on manager PowerShell
[19/11/2024 00:01:29] Loaded operation parameters for package id=Microsoft.WinGet.Client on manager PowerShell and operation Update: Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force  -Scope AllUsers
[19/11/2024 00:01:41] Loaded operation parameters for package id=Microsoft.WinGet.Client on manager PowerShell and operation Update: Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force  -Scope CurrentUser

### Package Managers Logs

```text
Manager WinGet with version:
System WinGet CLI Version: v1.9.25180
Using Native WinGet helper (COM Api)

——————————————————————————————————————————

Logged native task on manager Winget. Task type is ListSources
Process start time: 19/11/2024 00:00:06
Process end time:   19/11/2024 00:00:06

-- Task information
 ...

The task reported success

——————————————————————————————————————————

Logged subprocess-based task on manager Winget. Task type is RefreshIndexes
Subprocess executable: "C:\Users\<redacted>\AppData\Local\Microsoft\WindowsApps\winget.exe"
Command-line arguments: " source update --disable-interactivity"
Process start time: 19/11/2024 00:00:08
Process end time:   19/11/2024 00:00:09

-- Process STDOUT
 ...

Return code: SUCCESS (0)

——————————————————————————————————————————

Logged native task on manager Winget. Task type is ListInstalledPackages
Process start time: 19/11/2024 00:00:08
Process end time:   19/11/2024 00:00:16

-- Task information
 ...

The task reported success

——————————————————————————————————————————

Logged native task on manager Winget. Task type is ListSources
Process start time: 19/11/2024 00:00:09
Process end time:   19/11/2024 00:00:09

-- Task information
 ...

The task reported success

——————————————————————————————————————————

Logged native task on manager Winget. Task type is ListUpdates
Process start time: 19/11/2024 00:00:13
Process end time:   19/11/2024 00:00:18

-- Task information
 ...

The task reported success

——————————————————————————————————————————


### Relevant information

_No response_

### Screenshots and videos

_No response_
JAK1047 commented 3 days ago

Technically -Scope would be supported on everything Powershell 3.0 and above the difference is in the PowershellGet module it comes from. The default Windows Powershell ships with the original 1.0.0.1 version of the module that is missing several modern features

image

Microsoft's recommendation is to upgrade the PowershellGet module since the base version does not work properly with the Powershell Gallery to receive module updates. Why Microsoft has decided to leave the base version in I have no clue my only guess is they abandoned Windows Powershell to focus on Powershell Core version 7 and up.

image

https://learn.microsoft.com/en-us/powershell/gallery/powershellget/overview?view=powershellget-3.x

Might be nice for UniGetUI to give a warning to folks with the Powershell manager enabled who have the base module version still.

marticliment commented 3 days ago

Please test if the latest beta release fixes the issue for you: https://github.com/marticliment/UniGetUI/releases/tag/3.1.4-beta1