mkevenaar / chocolatey-packages

My chocolatey packages
https://mkevenaar.github.io/chocolatey-packages/
Apache License 2.0
42 stars 66 forks source link

Cannot install microsoft-windows-terminal #203

Open ErikLevin opened 10 months ago

ErikLevin commented 10 months ago

When installing the microsoft-windows-terminal package it fails with the error message Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Version"..

Steps to Reproduce (for bugs)

  1. As admin, run choco install microsoft-windows-terminal -y
  2. It fails with the above error.

Your Environment

mkevenaar commented 10 months ago

I have tried to reproduce this issue, and I cannot reproduce this with the environment mentioned above.

If you have some more insights on installed software and appx packages, please add this to this issue.

pauby commented 10 months ago

I am going to caveat this with 'I haven't reproduced this'.

I know when creating packages that use AppX that if you install an x64 AppX package, it will actually install both x86 and x64.

So if two items are returned as an array, by this line, then Version will not be present. Maybe changing the line to [version]$AppxVer = (Get-AppxPackage -Name $AppxPackageName -AllUsers -PackageTypeFilter Bundle)[0].Version might do the trick.

Again, haven't tested this, maybe it's not applicable here as you are using a -PackageBundleTypeFilter parameter which might always return one item. But I thought I'd mention it.

ErikLevin commented 9 months ago

@mkevenaar Sorry for taking me a while to get back to this. I can't reproduce it now either. I had problems on one of my machines but not the other. Now it install and uninstall both pass on the problematic machine with no errors.

opoplawski commented 9 months ago

It get the same error with the following condition:

PS C:\WINDOWS\system32> Get-AppxPackage -Name "Microsoft.WindowsTerminal" -AllUsers

Name                   : Microsoft.WindowsTerminal
Publisher              : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture           : X64
ResourceId             :
Version                : 1.17.11461.0
PackageFullName        : Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe
InstallLocation        : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe
IsFramework            : False
PackageFamilyName      : Microsoft.WindowsTerminal_8wekyb3d8bbwe
PublisherId            : 8wekyb3d8bbwe
PackageUserInformation : {S-1-5-21-89655523-1570529619-2103694531-2603 [NWRA\orion]: Installed}
IsResourcePackage      : False
IsBundle               : False
IsDevelopmentMode      : False
NonRemovable           : False
IsPartiallyStaged      : False
SignatureKind          : Store
Status                 : Ok

Name                   : Microsoft.WindowsTerminal
Publisher              : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture           : X64
ResourceId             :
Version                : 1.18.2681.0
PackageFullName        : Microsoft.WindowsTerminal_1.18.2681.0_x64__8wekyb3d8bbwe
InstallLocation        : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.18.2681.0_x64__8wekyb3d8bbwe
IsFramework            : False
PackageFamilyName      : Microsoft.WindowsTerminal_8wekyb3d8bbwe
PublisherId            : 8wekyb3d8bbwe
PackageUserInformation : {S-1-5-18 [S-1-5-18]: Staged}
IsResourcePackage      : False
IsBundle               : False
IsDevelopmentMode      : False
NonRemovable           : False
IsPartiallyStaged      : False
SignatureKind          : Store
Status                 : Ok

PS C:\WINDOWS\system32> choco list microsoft-windows-terminal
Chocolatey v2.2.2
microsoft-windows-terminal 1.18.2681
1 packages installed.
PS C:\WINDOWS\system32> choco install microsoft-windows-terminal -y --force --version 1.17.11461.0
Chocolatey v2.2.2
Installing the following packages:
microsoft-windows-terminal
By installing, you accept licenses for the packages.
Progress: Downloading microsoft-windows-terminal 1.17.11461.0... 100%

microsoft-windows-terminal v1.17.11461 (forced) [Approved]
microsoft-windows-terminal package files install completed. Performing other installation steps.
ERROR: Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Version".
The install of microsoft-windows-terminal was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\microsoft-windows-terminal\tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - microsoft-windows-terminal (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\microsoft-windows-terminal\tools\chocolateyInstall.ps1'.
 See log for details.

So it does seem to be related to having multiple versions installed as @pauby suggested.

rklec commented 1 month ago

Duplicate of https://github.com/mkevenaar/chocolatey-packages/issues/228