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
12.13k stars 411 forks source link

[BUG] IndexOutOfRangeException with non global npm list #2067

Closed NorbertHD closed 3 months ago

NorbertHD commented 5 months ago

Please confirm these before moving forward

Describe your issue

When WingetUi searches for npm updates there is an IndexOutOfRangeException in the logs.

"npm list" gives the output "`-- (empty)". After the split with "@" there is only one element in the "elements" array. And then "elements[1]" leads to the IndexOutOfRangeException.

Please add:

if (elements.Length >= 2)

before line 155 in file Npm.cs

Steps to reproduce the issue

No response

WingetUI Log

LoadComponentsAsync finished executing. All managers loaded. Proceeding to interface.
Error finding installed packages on manager Npm: 
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ModernWindow.PackageEngine.Managers.Npm.GetInstalledPackages_UnSafe()
   at ModernWindow.PackageEngine.Classes.PackageManager.GetInstalledPackages() in Y:\WingetUI-Store\src\wingetui\PackageEngine\Classes\Manager.cs:line 192

Package Managers Logs

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:50] Winget ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Program Files\WingetUI\PackageEngine\Managers\winget-cli_x64\winget.exe
█  Arguments:  source list
Name    Argument
-----------------------------------------------------
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0
winget  https://cdn.winget.microsoft.com/cache
[30.03.2024 16:44:50] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:50] Chocolatey ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\WingetUI\choco-cli\choco.exe
█  Arguments:  source list
Chocolatey v2.2.2
chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
[30.03.2024 16:44:50] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:51] PowerShell ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Windows\system32\windowspowershell\v1.0\powershell.exe
█  Arguments:  -NoProfile -Command Get-PSRepository
Name                      InstallationPolicy   SourceLocation                                                          
----                      ------------------   --------------                                                          
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2                                
[30.03.2024 16:44:51] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:51] Winget ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Program Files\WingetUI\PackageEngine\Managers\winget-cli_x64\winget.exe
█  Arguments:  source list
Name    Argument
-----------------------------------------------------
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0
winget  https://cdn.winget.microsoft.com/cache
[30.03.2024 16:44:51] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:52] .NET Tool ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Program Files\dotnet\dotnet.exe
█  Arguments: tool list --global
Paket-ID                   Version      Befehle              
-------------------------------------------------------------
dotnet-tools-outdated      0.7.1        dotnet-tools-outdated
[30.03.2024 16:44:52] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:52] Chocolatey ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\WingetUI\choco-cli\choco.exe
█  Arguments:  source list
Chocolatey v2.2.2
chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
[30.03.2024 16:44:52] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:52] Pip ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\Python\Python312\python.exe
█  Arguments:  -m pip list
Package            Version
------------------ --------
cffi               1.16.0
charset-normalizer 3.3.2
cryptography       42.0.5
Deprecated         1.2.14
deprecation        2.1.0
img2pdf            0.5.1
lxml               5.1.1
markdown-it-py     3.0.0
mdurl              0.1.2
ocrmypdf           16.1.2
packaging          24.0
pdfminer.six       20231228
pikepdf            8.14.0
pillow             10.2.0
pip                24.0
pluggy             1.4.0
pycparser          2.21
Pygments           2.17.2
rich               13.7.1
wrapt              1.16.0
[30.03.2024 16:44:52] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:52] .NET Tool ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\.dotnet\tools\dotnet-tools-outdated.exe
█  Arguments: 
[30.03.2024 16:44:52] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:52] Chocolatey ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\WingetUI\choco-cli\choco.exe
█  Arguments:  list
Chocolatey v2.2.2
0 packages installed.
Did you know Pro / Business automatically syncs with Programs and
 Features? Learn more about Package Synchronizer at
 https://chocolatey.org/compare
[30.03.2024 16:44:52] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:53] Chocolatey ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\WingetUI\choco-cli\choco.exe
█  Arguments:  outdated
Chocolatey v2.2.2
Outdated Packages
 Output is package name | current version | available version | pinned?
Chocolatey has determined 0 package(s) are outdated. 
[30.03.2024 16:44:53] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:53] PowerShell ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Windows\system32\windowspowershell\v1.0\powershell.exe
█  Arguments:  -NoProfile -Command Get-PSRepository
Name                      InstallationPolicy   SourceLocation                                                          
----                      ------------------   --------------                                                          
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2                                
[30.03.2024 16:44:53] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:53] Winget ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Program Files\WingetUI\PackageEngine\Managers\winget-cli_x64\winget.exe
█  Arguments:  list  --accept-source-agreements
   \ 
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 9.71 MB
  ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 9.71 MB
  █████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  3.00 MB / 9.71 MB
  ████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB / 9.71 MB
  ███████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 9.71 MB
  ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒  6.00 MB / 9.71 MB
  █████████████████████▒▒▒▒▒▒▒▒▒  7.00 MB / 9.71 MB
  ████████████████████████▒▒▒▒▒▒  8.00 MB / 9.71 MB
  ███████████████████████████▒▒▒  9.00 MB / 9.71 MB
  ██████████████████████████████  9.71 MB / 9.71 MB
   - 
Name                                     Id                                       Version          Available     Source
-----------------------------------------------------------------------------------------------------------------------
TortoiseGit                              0BF99681-825C-4B2A-A14F-2AC01DB9B70E_n6… 1.0.0.0                        
...
Microsoft Windows Desktop Runtime - 8.0… Microsoft.WindowsAppRuntime.1.5          < 1.5.0          1.5.1         winget
[30.03.2024 16:44:53] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:54] Npm ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Windows\system32\windowspowershell\v1.0\powershell.exe
█  Arguments:  -NoProfile -ExecutionPolicy Bypass -Command npm outdated --global --parseable
[30.03.2024 16:44:54] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:54] Winget ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Program Files\WingetUI\PackageEngine\Managers\winget-cli_x64\winget.exe
█  Arguments:  update --include-unknown  --accept-source-agreements
   \ 
   / 
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 9.71 MB
  ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 9.71 MB
  █████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  3.00 MB / 9.71 MB
  ████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB / 9.71 MB
  ███████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 9.71 MB
  ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒  6.00 MB / 9.71 MB
  █████████████████████▒▒▒▒▒▒▒▒▒  7.00 MB / 9.71 MB
  ████████████████████████▒▒▒▒▒▒  8.00 MB / 9.71 MB
  ███████████████████████████▒▒▒  9.00 MB / 9.71 MB
  ██████████████████████████████  9.71 MB / 9.71 MB
   - 
Name                                                 Id                              Version       Available     Source
-----------------------------------------------------------------------------------------------------------------------
Google Chrome                                        Google.Chrome                   123.0.6312.86 123.0.6312.87 winget
Mp3tag v3.24b                                        Mp3tag.Mp3tag                   3.24b         3.24          winget
Microsoft Visual C++ 2015-2022 Redistributable (x86… Microsoft.VCRedist.2015+.x86    14.38.33135.0 14.40.33617.1 winget
Microsoft Visual C++ 2015-2022 Redistributable (x64… Microsoft.VCRedist.2015+.x64    14.38.33135.0 14.40.33617.1 winget
Microsoft Windows Desktop Runtime - 8.0.3 (x64)      Microsoft.WindowsAppRuntime.1.5 < 1.5.0       1.5.1         winget
5 upgrades available.
[30.03.2024 16:44:54] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:54] PowerShell ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Windows\system32\windowspowershell\v1.0\powershell.exe
█  Arguments:  -NoProfile -Command Get-InstalledModule
Version              Name                                Repository           Description                              
-------              ----                                ----------           -----------                              
1.4.8.1              PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) is a...
5.5.0                Pester                              PSGallery            Pester provides a framework for runnin...
2.2.5                PowerShellGet                       PSGallery            PowerShell module with commands for di...
2.3.4                PSReadLine                          PSGallery            Great command line editing in the Powe...
[30.03.2024 16:44:54] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:54] Pip ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Users\Norbert\AppData\Local\Programs\Python\Python312\python.exe
█  Arguments:  -m pip list --outdated
Package   Version Latest Type
--------- ------- ------ -----
pycparser 2.21    2.22   wheel
[30.03.2024 16:44:54] Exit Code: 0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█▀▀▀▀▀▀▀▀▀ [30.03.2024 16:44:56] PowerShell ▀▀▀▀▀▀▀▀▀▀▀
█  Executable: C:\Windows\system32\windowspowershell\v1.0\powershell.exe
█  Arguments: 
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Installieren Sie die neueste PowerShell f�r neue Funktionen und Verbesserungen! https://aka.ms/PSWindows
PS C:\Program Files\WingetUI> 
PS C:\Program Files\WingetUI>                 function Test-GalleryModuleUpdate {
>>                     param (
>>                         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name,
>>                         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version,
>>                         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository,
>>                         [switch] $NeedUpdateOnly
>>                     )
>>                     process {
>>                         $URLs = @{}
>>                         @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation})
>>                         $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -Maximum 0 -ea Ignore
>>                         [version]$latest = Split-Path -Path ($page.Headers.Location -replace "$Name." -replace ".nupkg") -Leaf
>>                         $needsupdate = $Latest -gt $Version
>>                         if ($needsupdate) {
>>                                 Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository)
>>                         }
>>                     }
>>                 }
>>                 Get-InstalledModule | Test-GalleryModuleUpdate
PS C:\Program Files\WingetUI>                 exit
[30.03.2024 16:44:56] Exit Code: 0

Relevant information

No response

Screenshots and videos

No response

marticliment commented 5 months ago

Please shatr your Package Manager logs, so I can see which packages are failing

NorbertHD commented 5 months ago

Original post updated with Package Manager log. Thanks for looking into it.

marticliment commented 5 months ago

Nice!

edumserrano commented 5 months ago

I'm also getting this error on version 3.0.2:

LoadComponentsAsync finished executing. All managers loaded. Proceeding to interface. Error finding installed packages on manager Npm: System.IndexOutOfRangeException: Index was outside the bounds of the array. at ModernWindow.PackageEngine.Managers.Npm.GetInstalledPackages_UnSafe() at ModernWindow.PackageEngine.Classes.PackageManager.GetInstalledPackages() in C:\Users\marti\Desktop\wingetui-tempo\src\wingetui\PackageEngine\Classes\Manager.cs:line 192 Invalid value for UpdatesCheckInterval, using default value of 3600 seconds

Is there any extra info I can provide?

marticliment commented 5 months ago

This is fine, I don't need more details