locked
End of Central Directory record could not be found - can't install or update any modules. RRS feed

  • Question

  • Hello,

    Iv'e been stuck a while trying to install a new module from PSGallery. Unfortunately, I keep getting this error: "Package <package-name> failed to be installed because: End of Central Directory record could not be found."
    I searched for an hour for solutions on google with no luck. I tried updating 'PowerShellGet' and 'PackageManagement' but kept getting the same error.

    why on earth don't they just give a link to download the module directly from the website so I don't get completely stuck at cases like this?

    this is very frustrating.
    all help is much appreciated.

    Thursday, September 7, 2017 7:27 AM

Answers

  • Hi,

    I forgot about this thread and a recent alert email notification reminded me of it..

    just updating here that the culprit ended up to be the company proxy server. 

    not sure what exactly was going wrong, but the security team claimed that by all accounts the proxy should allow the traffic to go through, and they are unable to figure out why it isn't. they ended up allowing me to temporary bypass the proxy every time I wanted to install a module.

    whatever the reason is.. Microsoft should definitely articulate their error messages better.


    Thursday, June 27, 2019 11:28 AM
  • You have to be running PowerShell 5.0 or later.  You also have to have the correct Net components installed.  You must also be running at an elevated prompt.

    First try finding the module: Find-Module <modulename>

    Once found try installing it:

      Find-Module <modulename> | Install-Module -Force

    You can also just download the module"

    Find-Module <modulename> | Save-Module <path to save to>

    The error sounds like you may not have the correct Net components installed.  It is usually a compression/decompression error.


    \_(ツ)_/


    Thursday, September 7, 2017 8:04 AM

All replies

  • You have to be running PowerShell 5.0 or later.  You also have to have the correct Net components installed.  You must also be running at an elevated prompt.

    First try finding the module: Find-Module <modulename>

    Once found try installing it:

      Find-Module <modulename> | Install-Module -Force

    You can also just download the module"

    Find-Module <modulename> | Save-Module <path to save to>

    The error sounds like you may not have the correct Net components installed.  It is usually a compression/decompression error.


    \_(ツ)_/


    Thursday, September 7, 2017 8:04 AM
  • thanks for the quick reply.

    I am running powershell 5.1 (windows 10 1703 64bit)

    .net version is 4.7.02046

    and the output for clrver.exe was:

    v2.0.50727
    v4.0.30319

    what am I missing?


    Thursday, September 7, 2017 8:50 AM
  • What happens when you run the code examples I posted?

    Net is many more modules than the two you posted.

    Try installing the module with the commands I posted.


    \_(ツ)_/

    Thursday, September 7, 2017 8:52 AM
  • the original module I tried downloading was SNMP. using your code examples:

    PS C:\WINDOWS\system32>  Find-Module snmp
    
    Version    Name                                Repository           Description
    -------    ----                                ----------           -----------
    1.0.0.1    SNMP                                PSGallery            Module to manage systems using SNMP.
    
    
    PS C:\WINDOWS\system32>  Find-Module snmp | Install-Module -force
    PackageManagement\Install-Package : Package 'SNMP' failed to be installed because: End of Central Directory record could not be found.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1912 char:34
    + ...          $null = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidResult: (SNMP:String) [Install-Package], Exception
        + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
    
    PS C:\WINDOWS\system32>
    
    I found this page describing the issue: https://docs.microsoft.com/en-us/powershell/gallery/psgallery/psgallery_status
    but it also states that this issue is solved (though pending further investigation)
    Thursday, September 7, 2017 9:00 AM
  • I would recommend running the net framework diagnostics to see if all components are healthy.


    \_(ツ)_/

    Thursday, September 7, 2017 9:11 AM
  • used the repair tool from this link: https://support.microsoft.com/en-us/help/2698555/microsoft--net-framework-repair-tool-is-available

    didn't help.

    Thursday, September 7, 2017 1:02 PM
  • Then you need to do a system reset to rebuild the basic W10 system.

    \_(ツ)_/

    Thursday, September 7, 2017 3:33 PM
  • you mean windows?
    that sound a little extreme. 

    Thursday, September 7, 2017 4:30 PM
  • You need to repair the problem.  The only way to do this quickly is a reset.

    The issue is not a scripting issue as you have already proven.  Somewhere you have clobbered the system or you have a bad disk or other issues.  A reset will check all of this.

    Unfortunately this is not a break/fix forum so either troubleshoot your system or reset it.  We cannot be of help beyond that.


    \_(ツ)_/

    Thursday, September 7, 2017 4:40 PM
  • Although, the thread is a bit old, but adding my few cents.

    > You need to repair the problem.  The only way to do this quickly is a reset.

    that's insane. What's the point to engage in thread when you don't know the answer and even don't know where to start from?

    Actually, the problem is not with .NET, so reset won't help. The problem is with ZIP archive. ZIP package contains a central directory with a list of all compressed files and their relative path (in other words, compressed file system structure). What exact issue with this ZIP is another question. What you should do is to file a bug in package's project page and ask maintainers to replace the corrupt zip.


    Vadims Podāns, aka PowerShell CryptoGuy
    My weblog: www.sysadmins.lv
    PowerShell PKI Module: PSPKI
    Check out new: SSL Certificate Verifier
    Check out new: PowerShell File Checksum Integrity Verifier tool.

    Thursday, December 28, 2017 2:04 PM
  • Other components can cause this issue.  The module is not at issue but the underlying system and Net support will cause this.

    I have downloaded and installed this module with no issues on any system with working Net and OS.  It is not the module.


    \_(ツ)_/

    Thursday, December 28, 2017 2:28 PM
  • Hi,

    I forgot about this thread and a recent alert email notification reminded me of it..

    just updating here that the culprit ended up to be the company proxy server. 

    not sure what exactly was going wrong, but the security team claimed that by all accounts the proxy should allow the traffic to go through, and they are unable to figure out why it isn't. they ended up allowing me to temporary bypass the proxy every time I wanted to install a module.

    whatever the reason is.. Microsoft should definitely articulate their error messages better.


    Thursday, June 27, 2019 11:28 AM