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

Show-Karma fails after repo-based installation #462

Open
johnheusinger opened this issue Oct 9, 2021 · 2 comments
Open

Show-Karma fails after repo-based installation #462

johnheusinger opened this issue Oct 9, 2021 · 2 comments
Labels
Category-Module Pertaining to the module's functionality itself. Issue-Discussion Let's talk about it!

Comments

@johnheusinger
Copy link
Contributor

Describe "Module Bug or Issue"

Identical to the issue reported in #452

Context "The Problem"

After following the repo-based installation steps and running Show-Karma, I receive the following error:

PS C:\code\PSKoans> Show-Karma
Show-Karma : The 'Show-Karma' command was found in the module 'PSKoans', but the module could not be loaded. For more
information, run 'Import-Module PSKoans'.
At line:1 char:1
+ Show-Karma
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Show-Karma:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Running Import-Module PSKoans as suggested in the first error message:

PS C:\code\PSKoans> Import-Module PSKoans
Import-Module : The member 'FormatsToProcess' in the module manifest is not valid: Cannot find path
'C:\code\PSKoans\PSKoans\PSKoans.format.ps1xml' because it does not exist.. Verify that a valid value is specified for
this field in the 'C:\code\PSKoans\PSKoans\PSKoans.psd1' file.
At line:1 char:1
+ Import-Module PSKoans
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\code\PSKoans\PSKoans\PSKoans.psd1:String) [Import-Module], Argu
   mentException
    + FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.ImportModuleCommand

Installing EZOut using -AllowClobber and running PSKoans.ezformat.ps1 as suggested in #452:

PS C:\code\PSKoans> Install-Module EZOut -AllowClobber
PS C:\code\PSKoans> .\PSKoans.ezformat.ps1
PS C:\code\PSKoans>

Running Show-Karma again:

PS C:\code\PSKoans> Show-Karma
Show-Karma : You cannot call a method on a null-valued expression.
At line:1 char:1
+ Show-Karma
+ ~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Show-Karma], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Show-Karma

Checking $Error[0].Exception.GetBaseException() | Format-List -Force as suggested in #452:

PS C:\code\PSKoans> $Error[0].Exception.GetBaseException() | Format-List -Force

ErrorRecord                 : You cannot call a method on a null-valued expression.
WasThrownFromThrowStatement : False
Message                     : You cannot call a method on a null-valued expression.
Data                        : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException              :
TargetSite                  : Void CheckActionPreference(System.Management.Automation.Language.FunctionContext,
                              System.Exception)
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(Interp
                              retedFrame frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Interp
                              retedFrame 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.PSScriptCmdlet.DoEndProcessing()
                                 at System.Management.Automation.CommandProcessorBase.Complete()
HelpLink                    :
Source                      : System.Management.Automation
HResult                     : -2146233087

Context "Additional Information"

Name    Version
----    -------
PSKoans 0.67.0
PSKoans 0.67.0
Name                           Value
----                           -----
PSVersion                      5.1.22000.65
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.65
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Also attempted using PS 7.1.4 on both Windows and macOS with similar results.

No issues when installing from gallery.

@johnheusinger johnheusinger added Category-Module Pertaining to the module's functionality itself. Issue-Discussion Let's talk about it! labels Oct 9, 2021
@johnheusinger
Copy link
Contributor Author

I also found it odd that the version is showing 0.67.0 although the latest release is 0.67.1.

Looking at the 0.67.1 release, I see that the file PSKoans.psd1 incorrectly contains the line:

ModuleVersion         = '0.67.0'

And yet the output of Get-Module -Name PSKoans correctly shows Version 0.67.1 when installed from the gallery.

@billyhigdon
Copy link

Howdy @johnheusinger - I know this is over two years later - but I ran into the same issue. Took me a little bit to figure out the EZOut module stuff (wish I had just looked into the issues sooner). For me I had the same experience when using Show-Karma and upon checking my modules, I could see it was using Pester 5.5.0 - for some reason everytime i imported PSKoans it would import the latest available version of the module - even though 5.0.2 was installed.

I tried going through the code to see where it actually imports the module - i'm assuming somewhere it doesn't explicitly state to use 5.0.2 and that's why the latest version is imported. Eventually I just uninstalled 5.5.0 and next time I imported the PSKoans module, it imported 5.0.2 and the Show-Karma cmdlet started working as normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Module Pertaining to the module's functionality itself. Issue-Discussion Let's talk about it!
Projects
None yet
Development

No branches or pull requests

2 participants