PowerShellGallery icon indicating copy to clipboard operation
PowerShellGallery copied to clipboard

PoshRSJob cannot be downloaded due to End of Central Directory record could not be found.

Open Xiaoyu-Huang opened this issue 11 months ago • 3 comments

Prerequisites

  • [x] Write a descriptive title.
  • [x] Make sure you are able to repro it on the latest version
  • [x] Search the existing issues.

Steps to reproduce

I have issues to download PoshRSJob with error End of Central Directory record could not be found. The issue started happening Jan 13.

here is the command Install-Module -Name PoshRSJob -Force -AllowClobber

I ran below command to see the verbose error Install-Module -Name PoshRSJob -Verbose

here is the mesage

VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4'. VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4'. VERBOSE: Completed downloading 'PoshRSJob'. VERBOSE: Hash for package 'PoshRSJob' does not match hash provided from the server. VERBOSE: InstallPackageLocal' - name='PoshRSJob',

Expected behavior

PoshRSJob should be able to download successfully

Actual behavior

PackageManagement\Install-Package : Package 'PoshRSJob' failed to be installed because: End of Central Directory record could not be found.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (PoshRSJob:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Error details


Environment data

Name                           Value
----                           -----
PSVersion                      5.1.22621.4391
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.4391
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

5.1.22621.4391

Visuals

No response

Xiaoyu-Huang avatar Jan 16 '25 20:01 Xiaoyu-Huang

I stumbled upon the same problem. Weirdly, if I download the nupkg manually, it seems valid.

As a workaround, I downloaded the module to a local directory and told Install-Module to use that as the source repository:

mkdir C:\TempPackages
Invoke-WebRequest -UseBasicParsing -Uri 'https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4' -OutFile 'C:\TempPackages\PoshRSJob.1.7.4.4.nupkg'
Register-PSRepository -Name local -SourceLocation C:\TempPackages -InstallationPolicy Trusted
Install-Module PoshRSJob -Verbose -Scope AllUsers -Repository local

(On the same machine, other modules such as Az, Microsoft.Graph or Posh-ACME install from PSGallery perfectly fine.)

jberezanski avatar Jan 18 '25 20:01 jberezanski

@jberezanski For me, the package installation cmd is part of the deployment script. So I am unable to preinstall the package on machine

Xiaoyu-Huang avatar Jan 20 '25 21:01 Xiaoyu-Huang

Hi,

I can confirm I'm affected, using mcr.microsoft.com/powershell:latest in a Docker file.

EmilienCourt avatar Jan 28 '25 09:01 EmilienCourt

Same problem when installing or saving UserProfile module.

peetrike avatar Jun 30 '25 06:06 peetrike

I'm in the same boat:

PS C:\Users\rob> Install-Module -Name PoshRSJob -Scope AllUsers -Force -Verbose
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='PoshRSJob'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'PoshRSJob'.
VERBOSE: Performing the operation "Install-Module" on target "Version '1.7.4.4' of module 'PoshRSJob'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PoshRSJob' with version '1.7.4.4' from the repository 'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PoshRSJob'' for ''.
VERBOSE: InstallPackage' - name='PoshRSJob', version='1.7.4.4',destination='C:\Users\rob\AppData\Local\Temp\752416372'
VERBOSE: DownloadPackage' - name='PoshRSJob', version='1.7.4.4',destination='C:\Users\rob\AppData\Local\Temp\752416372\PoshRSJob.1.7.4.4\PoshRSJob.1.7.4.4.nupkg',
uri='https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PoshRSJob/1.7.4.4'.
VERBOSE: Completed downloading 'PoshRSJob'.
VERBOSE: Hash for package 'PoshRSJob' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='PoshRSJob', version='1.7.4.4',destination='C:\Users\rob\AppData\Local\Temp\752416372'
PackageManagement\Install-Package : Package 'PoshRSJob' failed to be installed because: End of Central Directory record could not be found.
At C:\Users\rob\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (PoshRSJob:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Again, note the hash issue: "VERBOSE: Hash for package 'PoshRSJob' does not match hash provided from the server."

Out an abundance of caution, I've installed it from the GitHub repo instead (elevated PowerShell prompt):

New-Item -Path "C:\Program Files\WindowsPowerShell\Modules" -Name PoshRSJob -Type Directory
Invoke-WebRequest -Uri https://github.com/proxb/PoshRSJob/releases/download/1.7.4.4/PoshRSJob.zip -OutFile "$env:TEMP\PoshRSJob.zip"
Expand-Archive -Path "$env:TEMP\PoshRSJob.zip" -DestinationPath "C:\Program Files\WindowsPowerShell\Modules\PoshRSJob"

robpomeroy avatar Jul 07 '25 13:07 robpomeroy

for me, the PSResourceGet module helped. But it seems that there is some kind of problem in gallery that is somehow ignored by PSResourceGet module.

Also, the .nupkg file is downloadable and works with PowerShellGet module when served on local repository.

peetrike avatar Jul 07 '25 13:07 peetrike

but the problem stays with machines, where only Windows PowerShell with default module set are installed (and there is no local repository available).

peetrike avatar Jul 07 '25 13:07 peetrike

@peetrike Yeah, I avoided PS Gallery in case the issue is some kind of security compromise. 🤷‍♂

robpomeroy avatar Jul 07 '25 14:07 robpomeroy