Error to publish module to private repository

Francesco Farina 20 Reputation points
2023-01-25T11:28:34.6466667+00:00

I’m trying to publish a module, which I wrote, to a local repository. The repository is correctly created, if I type
get-psrepository
I see it. When I launch the command
Publish-Module -Path C:\Modules\mymodule -Repository MyRepository
the error that appears is the following

Publish-PSArtifactUtility : Failed to generate the compressed file for module 'Failed to index into an array
null.'.
In C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:10990 car:17
+ ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
     + CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
     + FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 46,811 Reputation points
    2023-01-25T16:32:11.0233333+00:00

    Are you doing this on a Windows machine that uses a language other than English? If so, have a look at this thread on GitHub: [https://github.com/PowerShell/PowerShellGetv2/issues/606

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Limitless Technology 44,401 Reputation points
    2023-01-26T17:07:11.8666667+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.

    This error message is indicating that the command "Publish-PSArtifactUtility" has failed to generate a compressed file for a PowerShell module. The specific module in question is "Failed to index into an array null." The error occurred in the file "C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1" on line 10990. The error is of type "InvalidOperation" and has the fully qualified error id of "FailedToCreateCompressedModule,Publish-PSArtifactUtility"

    It seems that the problem is with the module "Failed to index into an array null." which is causing the error. You should investigate this module and see if there is any issue with it. Also check the module's dependencies and ensure that they are installed and updated.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments

  2. Limitless Technology 44,401 Reputation points
    2023-01-26T17:07:30.1233333+00:00

    Double post

    0 comments No comments

  3. Francesco Farina 20 Reputation points
    2023-01-29T12:55:05.03+00:00

    This command solve the problem.

    $env:DOTNET_CLI_UILANGUAGE="itIT"

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.