JustinGrote / ModuleFast

A "fast and loose" way to install modules from Powershell Gallery quickly. Meant for CICD, not production
Other
74 stars 5 forks source link

Error on -Update with module name #69

Closed ThomasNieto closed 6 months ago

ThomasNieto commented 6 months ago

I'm not sure if this is a valid syntax but if its not maybe a better error message.

PS C:\> Install-ModuleFast powershellget -Update
Install-ModuleFast: Cannot find an overload for "Add" and the argument count: "1".
JustinGrote commented 6 months ago

That should be fine! Not sure what's happening there. Can you run it again with -verbose -debug?

JustinGrote commented 6 months ago

I think I found it. Will look into it

Exception             :
    Type        : System.Management.Automation.MethodException
    ErrorRecord :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : Cannot find an overload for "Add" and the argument count: "1".
            HResult : -2146233087
        CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : MethodCountCouldNotFindBest
        InvocationInfo        :
            ScriptLineNumber : 1664
            OffsetInLine     : 9
            HistoryId        : 106
            ScriptName       : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1        
            Line             : $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleBaseDir))

            Statement        : $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleBaseDir))
            PositionMessage  : At
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1:1664 char:9
                               +         $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleB …
                               +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            PSScriptRoot     : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1
            PSCommandPath    : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1        
            CommandOrigin    : Internal
        ScriptStackTrace      : at Find-LocalModule,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 1664
                                at Get-ModuleFastPlan<End>,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 528
                                at Install-ModuleFast<End>,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 352
                                at <ScriptBlock>, <No file>: line 1
    TargetSite  :
        Name          : CheckActionPreference
        DeclaringType : System.Management.Automation.ExceptionHandlingOps, System.Management.Automation,
Version=7.4.1.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message     : Cannot find an overload for "Add" and the argument count: "1".
    Source      : System.Management.Automation
    HResult     : -2146233087
    StackTrace  :
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception    
exception)
   at Find-LocalModule(Closure, FunctionContext)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object
inputToProcess)
   at System.Management.Automation.CommandProcessorBase.Complete()
CategoryInfo          : NotSpecified: (:) [], MethodException
FullyQualifiedErrorId : MethodCountCouldNotFindBest
InvocationInfo        :
    ScriptLineNumber : 1664
    OffsetInLine     : 9
    HistoryId        : 106
    ScriptName       : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1
    Line             : $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleBaseDir))

    Statement        : $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleBaseDir))
    PositionMessage  : At C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1:1664 char:9 
                       +         $candidatePaths.Add([Tuple]::Create($classicVersion, $moduleB …
                       +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PSScriptRoot     : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1
    PSCommandPath    : C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1
    CommandOrigin    : Internal
ScriptStackTrace      : at Find-LocalModule,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 1664
                        at Get-ModuleFastPlan<End>,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 528
                        at Install-ModuleFast<End>,
C:\Users\JGrote\AppData\Local\powershell\Modules\ModuleFast\0.1.1\ModuleFast.psm1: line 352
                        at <ScriptBlock>, <No file>: line 1
JustinGrote commented 6 months ago

Try it with the latest commit instructions https://github.com/JustinGrote/ModuleFast?tab=readme-ov-file#testing-latest-commit