Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Cannot push to PSGallery #597

Open
KevinZonda opened this issue Apr 12, 2020 · 11 comments · Fixed by #613
Open

Cannot push to PSGallery #597

KevinZonda opened this issue Apr 12, 2020 · 11 comments · Fixed by #613

Comments

@KevinZonda
Copy link

Steps to reproduce

Publish-Module -Name xxxxx -NuGetApiKey xxxx -Verbose

Expected behavior

Work normally

Actual behavior

Publish-PSArtifactUtility : Failed to generate the compressed file for module 'Cannot index into a null array.'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:10946 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility

image

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18362.628
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.628
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module PowerShellGet
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.2.3      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
@KevinZonda
Copy link
Author

I found the code which gives the exception

image

@KevinZonda
Copy link
Author

image

The error in PS 7.

My Windows 10 is 1903. Some 1909 can push successfully.

@alerickson
Copy link
Member

Thanks for pin-pointing the problem! From your original post it seems like the nupkg is getting created properly but somehow parsing the full file name isn't working. Could you let me know if the nupkg exists in the temporary folder that gets created (particularly when running in Windows PS since I see that the nupkg is definitely getting created there)?

@KevinZonda
Copy link
Author

KevinZonda commented Apr 19, 2020

image

@alerickson I think the NUGET package doesn't exist? My Windows user name is chinese, may it affect results?

@alerickson
Copy link
Member

alerickson commented Apr 22, 2020

@KevinZonda thank you! That's unfortunate, from the logs it seemed like the .nupkg was getting created properly, but not pushed (possibly due to incorrect parsing), but I'll have to dig in a bit more to see why exactly the nupkg isn't getting created properly.

I have a few more questions for you:
Do you have the nuget executable installed?
What is your $env:ProgramData path?
What is your $env:Path path?

Could you install the nuget exe from https://aka.ms/psget-nugetexe to "C:\Program Files\nuget"?

@glatzert
Copy link
Contributor

I'm seeing this behaviour as well (V 2.2.4). If needed, I can provide additional information about my system and environment. dotnet SDK is installed as well.
Using WindowsPowershell mitigates the problem (V 2.0.1)

ProcMon Traces and similar would be possible, as well as screen sharing via Teams or S4B

@KevinZonda
Copy link
Author

I'm seeing this behaviour as well (V 2.2.4). If needed, I can provide additional information about my system and environment. dotnet SDK is installed as well.
Using WindowsPowershell mitigates the problem (V 2.0.1)

ProcMon Traces and similar would be possible, as well as screen sharing via Teams or S4B

I install dotnet SDK too. What's ur Windows build? 1809, or...?

@glatzert
Copy link
Contributor

The latest installed dotnet SDK is 3.1.202
Windows Version is 1903

@KevinZonda
Copy link
Author

The latest installed dotnet SDK is 3.1.202
Windows Version is 1903

I want to upgrade my Windows. May it works.

@glatzert
Copy link
Contributor

glatzert commented Aug 2, 2020

Can you give any progress on this?
Or can we provide anything to allow you fixing the bug or providing us a workaround?

@glatzert
Copy link
Contributor

glatzert commented Aug 2, 2020

I just did some digging and I think I found the underlying problem:

Text-Parsing!

$stdOut -match "Successfully created package '(.*.nupkg)'" | Out-Null
$nupkgFullFile = $matches[1]

My machine speaks german. It'll probably report "Nuget-Packet erfolgreich erstellt" or something similar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants