Package failed to install because: End of Central Directory record could not be found.

Copper Contributor

Trying to install any package results in a hash mismatch. Here's my verbose output:

 

 

 

 

 

PS C:\Users\jh> install-module powershellget -verbose -scope AllUsers
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='powershellget'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'powershellget'.
VERBOSE: Performing the operation "Install-Module" on target "Version '2.2.3' of module 'PowerShellGet'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\PowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PowerShellGet' with version '2.2.3' from the repository 'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''.
VERBOSE: Package 'PackageManagement' is already installed.
VERBOSE: Package 'PackageManagement' is already installed.
VERBOSE: InstallPackage' - name='PowerShellGet', version='2.2.3',destination='C:\Users\jh\AppData\Local\Temp\1026672374'
VERBOSE: DownloadPackage' - name='PowerShellGet', version='2.2.3',destination='C:\Users\jh\AppData\Local\Temp\1026672374\PowerShellGet.2.2.3\PowerShellGet.2.2.3.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PowerShellGet
/2.2.3'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.3'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.3'.
VERBOSE: Completed downloading 'PowerShellGet'.
VERBOSE: Hash for package 'PowerShellGet' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='PowerShellGet', version='2.2.3',destination='C:\Users\jh\AppData\Local\Temp\1026672374'
Install-Package: C:\program files\powershell\7-preview\Modules\PowerShellGet\PSModule.psm1
Line |
9683 | $installedPackages = PackageManagement\Install-Package @PSBoundParameters
| ^ Package 'PowerShellGet' failed to be installed because: End of Central Directory record could not be found.

 

 

 

 

 

Running from a win10 work PC with admin rights in an elevated PowerShell session.
Any help would be appreciated.

3 Replies

Hi there @otaconjh, what's the output you get for $PSVersionTable ?

 

I'm assuming you're running one of the PowerShell 7 Previews (based on the error view), does this behavior still occur with RC3?

@otaconjh , This usually occurs due to proxy server. I have encountered same error. Please try bypassing the proxy server and check if it works.

 

Regards,

Azhar.

Hi all , I have the same problem, when downloading a PowerShell module from our 'own' Nexus repository.
PowerShell version is built-in 5.1 (5.1.17763.2268) for Windows 2019. Not using a proxy.

 

Note: I'm getting the same error in the verbose output:

 

VERBOSE: Completed downloading 'https://psrespository.mycompany.com/repository/corp_ps_nuget/MyTestModule/1.0.0'.
VERBOSE: Completed downloading 'MyTestModule'.
VERBOSE: Hash for package 'MyTestModule' does not match hash provided from the server.

 

And I have the following (ugly) workaround:

  • download the file using (New-Object System.Net.WebClient).DownloadFile
  • create a (temp) local psrepository from the folder where file is downloaded
  • install the module from the local psrepository
  • remove the local psrepository

so this shows to me the nuget itself is not corrupt. it may have to do with the hash on the Nexus itself

 


Regards, Ben