PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
432 stars 138 forks source link

Unable to save or install MS provided modules from gallery #667

Open BladeFireLight opened 2 years ago

BladeFireLight commented 2 years ago

We are unable to install MS provided modules in the gallery. 3rd party seem to work. I assume there is some sort of additional validation involved.

Steps to reproduce

Save-Module exchangeonlinemanagement -Repository psgallery -Path . -verbose -Force -AllowPrerelease
Save-Module exchangeonlinemanagement -Repository psgallery -Path . -verbose -Force

Expected behavior

this should save the module to the local folder. 

Actual behavior

WARNING: Package 'ExchangeOnlineManagement' failed to be installed because: Unknown block type. Stream might be corrupted.
WARNING: Package 'ExchangeOnlineManagement' failed to install.
VERBOSE: A task was canceled.
VERBOSE: A task was canceled.
PackageManagement\Save-Package : Unable to save the module 'ExchangeOnlineManagement'.
At C:\Users\user\Documents\WindowsPowershell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11794 char:21
+             $null = PackageManagement\Save-Package @PSBoundParameters
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
    + FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage

WARNING: Package 'ExchangeOnlineManagement' failed to be installed because: A local file header is corrupt.
WARNING: Package 'ExchangeOnlineManagement' failed to install.
PackageManagement\Save-Package : Unable to save the module 'ExchangeOnlineManagement'.
At C:\Users\user\Documents\WindowsPowershell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11794 char:21
+             $null = PackageManagement\Save-Package @PSBoundParameters
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
    + FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement
    Directory: C:\Users\dmjones-svr\Documents\WindowsPowershell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     2.2.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     2.2.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrere...
PowerShellGet            2.2.5.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathU...
PowerShellGet            1.0.0.1
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
StevenBucher98 commented 2 years ago

Thanks for your issue @BladeFireLight! We were unable to reproduce this issue and are no longer supporting PowerShellGetv2. What version of .NET are you running and can you possibly try the latest PowerShellGet v3 preview and see if this is still an issue?