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

%3CLINGO-SUB%20id%3D%22lingo-sub-1177267%22%20slang%3D%22en-US%22%3EPackage%20failed%20to%20install%20because%3A%20End%20of%20Central%20Directory%20record%20could%20not%20be%20found.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1177267%22%20slang%3D%22en-US%22%3E%3CP%3ETrying%20to%20install%20any%20package%20results%20in%20a%20hash%20mismatch.%20Here's%20my%20verbose%20output%3A%3C%2FP%3E%3CP%3E%3C!--%20%20%20%20%20%20StartFragment%20%20%20%20%20%20%20--%3E%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EPS%20C%3A%5CUsers%5Cjh%26gt%3B%20install-module%20powershellget%20-verbose%20-scope%20AllUsers%0AVERBOSE%3A%20Using%20the%20provider%20'PowerShellGet'%20for%20searching%20packages.%0AVERBOSE%3A%20The%20-Repository%20parameter%20was%20not%20specified.%20PowerShellGet%20will%20use%20all%20of%20the%20registered%20repositories.%0AVERBOSE%3A%20Getting%20the%20provider%20object%20for%20the%20PackageManagement%20Provider%20'NuGet'.%0AVERBOSE%3A%20The%20specified%20Location%20is%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2'%20and%20PackageManagementProvider%20is%20'NuGet'.%0AVERBOSE%3A%20Searching%20repository%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2%2FFindPackagesById()%3Fid%3D'powershellget''%20for%20''.%0AVERBOSE%3A%20Total%20package%20yield%3A'1'%20for%20the%20specified%20package%20'powershellget'.%0AVERBOSE%3A%20Performing%20the%20operation%20%22Install-Module%22%20on%20target%20%22Version%20'2.2.3'%20of%20module%20'PowerShellGet'%22.%0AVERBOSE%3A%20The%20installation%20scope%20is%20specified%20to%20be%20'AllUsers'.%0AVERBOSE%3A%20The%20specified%20module%20will%20be%20installed%20in%20'C%3A%5CProgram%20Files%5CPowerShell%5CModules'.%0AVERBOSE%3A%20The%20specified%20Location%20is%20'NuGet'%20and%20PackageManagementProvider%20is%20'NuGet'.%0AVERBOSE%3A%20Downloading%20module%20'PowerShellGet'%20with%20version%20'2.2.3'%20from%20the%20repository%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2'.%0AVERBOSE%3A%20Searching%20repository%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2%2FFindPackagesById()%3Fid%3D'PowerShellGet''%20for%20''.%0AVERBOSE%3A%20Package%20'PackageManagement'%20is%20already%20installed.%0AVERBOSE%3A%20Package%20'PackageManagement'%20is%20already%20installed.%0AVERBOSE%3A%20InstallPackage'%20-%20name%3D'PowerShellGet'%2C%20version%3D'2.2.3'%2Cdestination%3D'C%3A%5CUsers%5Cjh%5CAppData%5CLocal%5CTemp%5C1026672374'%0AVERBOSE%3A%20DownloadPackage'%20-%20name%3D'PowerShellGet'%2C%20version%3D'2.2.3'%2Cdestination%3D'C%3A%5CUsers%5Cjh%5CAppData%5CLocal%5CTemp%5C1026672374%5CPowerShellGet.2.2.3%5CPowerShellGet.2.2.3.nupkg'%2C%20uri%3D'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2%2Fpackage%2FPowerShellGet%0A%2F2.2.3'%0AVERBOSE%3A%20Downloading%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2%2Fpackage%2FPowerShellGet%2F2.2.3'.%0AVERBOSE%3A%20Completed%20downloading%20'https%3A%2F%2Fwww.powershellgallery.com%2Fapi%2Fv2%2Fpackage%2FPowerShellGet%2F2.2.3'.%0AVERBOSE%3A%20Completed%20downloading%20'PowerShellGet'.%0AVERBOSE%3A%20Hash%20for%20package%20'PowerShellGet'%20does%20not%20match%20hash%20provided%20from%20the%20server.%0AVERBOSE%3A%20InstallPackageLocal'%20-%20name%3D'PowerShellGet'%2C%20version%3D'2.2.3'%2Cdestination%3D'C%3A%5CUsers%5Cjh%5CAppData%5CLocal%5CTemp%5C1026672374'%0AInstall-Package%3A%20C%3A%5Cprogram%20files%5Cpowershell%5C7-preview%5CModules%5CPowerShellGet%5CPSModule.psm1%0ALine%20%7C%0A9683%20%7C%20%24installedPackages%20%3D%20PackageManagement%5CInstall-Package%20%40PSBoundParameters%0A%7C%20%5E%20Package%20'PowerShellGet'%20failed%20to%20be%20installed%20because%3A%20End%20of%20Central%20Directory%20record%20could%20not%20be%20found.%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3ERunning%20from%20a%20win10%20work%20PC%20with%20admin%20rights%20in%20an%20elevated%20PowerShell%20session.%3C%2FDIV%3E%3CDIV%3EAny%20help%20would%20be%20appreciated.%3C%2FDIV%3E%3CP%3E%3C!--%20%20%20%20%20%20EndFragment%20%20%20%20%20%20%20--%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1177267%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1202257%22%20slang%3D%22en-US%22%3ERe%3A%20Package%20failed%20to%20install%20because%3A%20End%20of%20Central%20Directory%20record%20could%20not%20be%20found.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1202257%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F560483%22%20target%3D%22_blank%22%3E%40otaconjh%3C%2FA%3E%2C%20what's%20the%20output%20you%20get%20for%26nbsp%3B%3C!--StartFragment%20--%3E%3CSPAN%3E%24PSVersionTable%20%3F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI'm%20assuming%20you're%20running%20one%20of%20the%20PowerShell%207%20Previews%20(based%20on%20the%20error%20view)%2C%20does%20this%20behavior%26nbsp%3Bstill%20occur%20with%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Freleases%2Ftag%2Fv7.0.0-rc.3%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ERC3%3C%2FA%3E%3F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3C!--EndFragment%20--%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1965683%22%20slang%3D%22en-US%22%3ERe%3A%20Package%20failed%20to%20install%20because%3A%20End%20of%20Central%20Directory%20record%20could%20not%20be%20found.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1965683%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F560483%22%20target%3D%22_blank%22%3E%40otaconjh%3C%2FA%3E%26nbsp%3B%2C%20This%20usually%20occurs%20due%20to%20proxy%20server.%20I%20have%20encountered%20same%20error.%20Please%20try%20bypassing%20the%20proxy%20server%20and%20check%20if%20it%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EAzhar.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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.

2 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.