New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish-Module throws error "Failed to generate the compressed file for module 'Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core'" #303

Closed
BrianFarnhill opened this Issue Jul 24, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@BrianFarnhill
Copy link

BrianFarnhill commented Jul 24, 2018

I'm currently putting together a demo that involves publishing a module using Publish-Module to a target NuGet server. I'm currently experiencing this on MacOS 10.12.6. The command and output I see are below:

Publish-Module -Path MyCustomSolution -NuGetApiKey $APIKey -Repository PublishTarget -Verbose

VERBOSE: Repository details, Name = 'PublishTarget', Location = 'http://SERVERNAME/nuget/modules/'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Repository details, Name = 'PublishTarget', Location = 'http://SERVERNAME/nuget/modules/'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Repository details, Name = 'PublishTarget', Location = 'http://SERVERNAME/nuget/modules/'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Publish Location:'http://SERVERNAME/nuget/modules/'.
VERBOSE: Loading module from path '/codebuild/output/src484376618/src/git-codecommit.ap-southeast-2.amazonaws.com/v1/repos/PowerShellDemo/MyCustomSolution/CoreCommands.psm1'.
VERBOSE: Module 'MyCustomSolution' was found in '/codebuild/output/src484376618/src/git-codecommit.ap-southeast-2.amazonaws.com/v1/repos/PowerShellDemo/MyCustomSolution'.
VERBOSE: Loading module from path '/tmp/128535449/MyCustomSolution/CoreCommands.psm1'.
VERBOSE: Repository details, Name = 'PublishTarget', Location = 'http://SERVERNAME/nuget/modules/'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the specified source names : 'PublishTarget'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'http://SERVERNAME/nuget/modules/' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'http://SERVERNAME/nuget/modules/FindPackagesById()?id='MyCustomSolution'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'MyCustomSolution'.
VERBOSE: Performing the operation "Publish-Module" on target "Version '1.0.0.0' of module 'MyCustomSolution'".
Publish-PSArtifactUtility : Failed to generate the compressed file for module 'Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core'.
At /opt/microsoft/powershell/6.1.0~preview.2/Modules/PowerShellGet/1.6.0/PSModule.psm1:1447 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility

Expected Behavior

Publish-Module should publish the module with no issues

Current Behavior

Getting error as described above

Steps to Reproduce (for bugs)

I have just an example PowerShell module at the moment, it loads up and runs locally no issues. When I call the publish command shown above it gives the error.

Context

This is about as bare of a solution as I can come up with right now, nothing complicated in the module itself, just trying to validate that publish-module will work from MacOS and then also from Ubuntu 14.04 once I get this going.

Your Environment

MacOS running PowerShell 6rc2, .net core 2.1 installed. Here's the output of PSVersionTable

Name Value


PSVersion 6.0.0-rc.2
PSEdition Core
GitCommitId v6.0.0-rc.2
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 21 20:07:39 PDT 2018; root:xnu-3789.73.14~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Get-Module -ListAvailable PowerShellGet,PackageManagement

ModuleType Version Name ExportedCommands


Script 1.1.7.0 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script 1.6.0 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}

Get-PackageProvider

Name Version DynamicOptions


NuGet 2.8.5.210 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 1.6.0.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Include...

@BrianFarnhill

This comment has been minimized.

Copy link
Author

BrianFarnhill commented Jul 25, 2018

OK so I have no idea what the root cause is here, but I figured out what was breaking it. I was passing in the values to my Register-PSRepository and Publish-Module commands using two environment variables - $env:APIKey and $env:TargetPath. The second I changed those two variables for different variable names (same values) everything came good! I'm sure there is some reason for this if you dig in under the hood but for the time being I have a work around, which is good enough - so I'm closing this one off and hopefully if anyone happens to stumble across it that its useful!

@kwirkykat

This comment has been minimized.

Copy link
Member

kwirkykat commented Oct 25, 2018

If anyone else runs into this issue, I was eventually able to fix it by starting a fresh PowerShell session and running this command to update the NuGet that was associated with my PowerShellGet module:

Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe"

Before that I had also tried updating my PowerShellGet module via Update-Module and updating NuGet in other ways (nuget update -self).
Not sure if I did that incorrectly or if I just needed to start a new session, but it didn't work until I ran the above line in a new session the next morning.

@cpolydorou

This comment has been minimized.

Copy link

cpolydorou commented Jan 7, 2019

The above command did the job for me. Thank you @kwirkykat!

@potatoqualitee

This comment has been minimized.

Copy link

potatoqualitee commented Feb 2, 2019

@kwirkykat 's response put me on the right path as well. I reinstalled a new, updated version of PowerShellGet and was set 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment