PowerShell / PowerShellGetv2

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

Publish-Module no longer work even for module which success before #700

Open clor09 opened 1 year ago

clor09 commented 1 year ago

Prerequisites

Steps to reproduce

I used to publish my module successfully to gallery server. after recently i update my module and try to publish the new version. everytime i just got following error:

Write-Error: Failed to generate the compressed file for module 'Cannot index into a null array.'.

i dont think it's a bad manifest or any ps file syntax issue. cause i test my lastest successful version, and only do an version update like Update-ModuleManifest -Path .\XXXXX.psd1 -ModuleVersion 0.0.6. then publish-module for this new test version, it just failed again.

Expected behavior

sussesfully run publish-module like before

Actual behavior

failed with error msg

> Write-Error: Failed to generate the compressed file for module 'Cannot index into a null array.'.

Error details

Type        : System.Management.Automation.ActionPreferenceStopException
ErrorRecord :
    Exception             :
        Type    : Microsoft.PowerShell.Commands.WriteErrorException
        Message : Failed to generate the compressed file for module 'Cannot index into a null array.'.
        HResult : -2146233087
    CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
    InvocationInfo        :
        MyCommand        : Publish-PSArtifactUtility
        ScriptLineNumber : 10990
        OffsetInLine     : 17
        HistoryId        : 8
        ScriptName       : C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1
        Line             : Publish-PSArtifactUtility @PublishPSArtifactUtility_Params

        PositionMessage  : At C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1:10990 char:17
                           + …             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param …
                           +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        PSScriptRoot     : C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet
        PSCommandPath    : C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1
        InvocationName   : Publish-PSArtifactUtility
        CommandOrigin    : Internal
    ScriptStackTrace      : at Publish-PSArtifactUtility, C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1: line 6011
                            at Publish-Module<Process>, C:\program files\windowsapps\microsoft.powershell_7.3.6.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1: line 10990
                            at <ScriptBlock>, <No file>: line 1
    PipelineIterationInfo :

TargetSite  :
    Name          : Invoke
    DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.3.6.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    MemberType    : Method
    Module        : System.Management.Automation.dll
Message     : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to generate the compressed file for module 'Cannot index into a null array.'.
Data        : System.Collections.ListDictionaryInternal
Source      : System.Management.Automation
HResult     : -2146233087
StackTrace  :
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

2.2.5

Visuals

No response

MrFly72 commented 8 months ago

Same here. Only solution I have found so far via google was to import the older module 1.0.0.1: import-module powershellget -RequiredVersion 1.0.0.1 But this has to happen in a fresh window, so that powershellget was not already loaded. Why is nobody of Microsoft taking care of this ?