chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.38k stars 902 forks source link

PowerShell 7.4.6 Operation Stopped when installing Chocolatey #3569

Open TechGuy419 opened 4 days ago

TechGuy419 commented 4 days ago

Checklist

What You Are Seeing?

PS C:\Users\username> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org) Getting latest version of the Chocolatey package for download. Not using proxy. Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0. Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0 to C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip Not using proxy. Extracting C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall

GAC Version Location


False v4.0.30319 C:\Program Files\PowerShell\7\WindowsBase.dll OperationStopped:

What is Expected?

The expectation is for the installation to complete without errors.

How Did You Get This To Happen?

My PC attempted to update to PowerShell 7.4.6 yesterday and failed. This resulted in the removal of PowerShell 7 from my PC. As a part of the troubleshooting, I removed the C:\ProgramData\chocolatey folder. I finally was successful with installing PowerShell 7.4.6 and attempted to reinstall Chocolatey. Below is the output of the attempt.

PS C:\Users\username> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org) Getting latest version of the Chocolatey package for download. Not using proxy. Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0. Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0 to C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip Not using proxy. Extracting C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\username\AppData\Local\Temp\chocolatey\chocoInstall

GAC Version Location


False v4.0.30319 C:\Program Files\PowerShell\7\WindowsBase.dll OperationStopped:

It appears the MS has updated the file version of the WindowsBase.dll to 8.0.1024.46810 and I believe that this is why the install is failing.

Image

System Details

Installed Packages

N/A

Output Log

Since the install is failing, C:\ProgramData\chocolatey does not exist.

Additional Context

No response

corbob commented 3 days ago

I have tried on a fully patched Windows 11 system with PowerShell 7.4.6 installed, and the Chocolatey installation worked without issue. This feels like an environment issue, but I'm not sure what aspect of the environment might be causing it. If you try with Windows PowerShell do you encounter the same issues?

TechGuy419 commented 3 days ago

It appears to have completed with errors. What version of WindowsBase.dll is on your PC?


Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows                                                                                                                                                       Loading personal and system profiles took 5055ms.                                                                       PS C:\Users\UserName> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.4.0 to C:\Users\UserName\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\UserName\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\UserName\AppData\Local\Temp\chocolatey\chocoInstall
New-Object : Exception calling ".ctor" with "3" argument(s): "End of Central Directory record could not be found."
At
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:934
char:23
+ ... ipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -Ar ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Installing Chocolatey on the local machine
& : The term 'C:\Users\UserName\AppData\Local\Temp\chocolatey\chocoInstall\tools\chocolateyInstall.ps1' is not
recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At line:538 char:3
+ & $chocoInstallPS1
+   ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\UserName...ateyInstall.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
PS C:\Users\UserName>
corbob commented 2 days ago

The WindowsBase.dll from PowerShell 7.4.6 is the same version that you have. Looking at the errors and where it stopped in both instances, it looks like the line that is causing issues is: Microsoft.PowerShell.Archive\Expand-Archive -Path $file -DestinationPath $tempDir -Force. Out of curiosity: are you able to use Expand-Archive to unzip any other files on your system? Or perhaps view them with Windows Explorer?