Skip to content
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 does not work when publishing module with dependencies #74

Open
3 tasks done
jformacek opened this issue Aug 21, 2024 · 0 comments
Open
3 tasks done

Comments

@jformacek
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Trying to publish module with dependency on other module via Publish-Module -Path xxx -NuGetApiGey yyy
Getting error:
ValidateAndGet-RequiredModuleDetails: The property 'Name' cannot be found on this object. Verify that the property exists.

Seems that problem is in PSModule.psm1:8112:

$RequiredModuleDetails += @{
                                            Name=$_.Name
                                            MinimumVersion=$_.Version
                                       }

variable $_ seems not to have value. Instead, there should be something like:

$RequiredModuleDetails += @{
                                            Name=$psgetItemInfo.Name
                                            MinimumVersion=$psgetItemInfo.Version
                                       }

Expected behavior

Publish-Module is able to publish module with dependencies.

Actual behavior

Publish-Module returns error "ValidateAndGet-RequiredModuleDetails: The property 'Name' cannot be found on this object. Verify that the property exists." when publishing module with dependencies

Error details

get-error

Exception             :
    Type        : System.Management.Automation.PropertyNotFoundException
    ErrorRecord :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : The property 'Name' cannot be found on this object. Verify that the property exists.
            HResult : -2146233087
        CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : PropertyNotFoundStrict
        InvocationInfo        :
            ScriptLineNumber : 8112
            OffsetInLine     : 13
            HistoryId        : 2
            ScriptName       : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
            Line             : $RequiredModuleDetails += @{

            Statement        : $RequiredModuleDetails += @{
                               Name=$_.Name
                               MinimumVersion=$_.Version
                               }
            PositionMessage  : At C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:8112 char:13
                               +             $RequiredModuleDetails += @{
                               +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            PSScriptRoot     : C:\program files\powershell\7\Modules\PowerShellGet
            PSCommandPath    : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
            CommandOrigin    : Internal
        ScriptStackTrace      : at ValidateAndGet-RequiredModuleDetails, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 8112
                                at Get-ModuleDependencies, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 1935
                                at Publish-PSArtifactUtility, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 5923
                                at Publish-Module<Process>, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 10990
                                at <ScriptBlock>, <No file>: line 1
    TargetSite  :
        Name          : CheckActionPreference
        DeclaringType : [System.Management.Automation.ExceptionHandlingOps]
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message     : The property 'Name' cannot be found on this object. Verify that the property exists.
    Data        : System.Collections.ListDictionaryInternal
    Source      : System.Management.Automation
    HResult     : -2146233087
    StackTrace  :
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception
exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object
inputToProcess)
   at System.Management.Automation.CommandProcessorBase.Complete()
CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
FullyQualifiedErrorId : PropertyNotFoundStrict
InvocationInfo        :
    ScriptLineNumber : 8112
    OffsetInLine     : 13
    HistoryId        : 2
    ScriptName       : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
    Line             : $RequiredModuleDetails += @{

    Statement        : $RequiredModuleDetails += @{
                       Name=$_.Name
                       MinimumVersion=$_.Version
                       }
    PositionMessage  : At C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:8112 char:13
                       +             $RequiredModuleDetails += @{
                       +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PSScriptRoot     : C:\program files\powershell\7\Modules\PowerShellGet
    PSCommandPath    : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
    CommandOrigin    : Internal
ScriptStackTrace      : at ValidateAndGet-RequiredModuleDetails, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 8112
                        at Get-ModuleDependencies, C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:
line 1935
                        at Publish-PSArtifactUtility, C:\program
files\powershell\7\Modules\PowerShellGet\PSModule.psm1: line 5923
                        at Publish-Module<Process>, C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:
line 10990
                        at <ScriptBlock>, <No file>: line 1

Environment data

$PSVersionTable

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

Version

PS Core 7.4.5

Visuals

No response

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

No branches or pull requests

1 participant