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

VScode error: Could not find the module 'PSKoans'. commands typed in console window work fine. #468

Open
doctrosix opened this issue Feb 8, 2022 · 2 comments
Labels
Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it!

Comments

@doctrosix
Copy link

Describe "Koan Bug, Issue, or Help Request"

All Koans.ps1 opened in VS code

Visual Studio Code
Version 1.64.0

Module versions installed:

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
5.3.1                Pester                              PSGallery            Pester provides a framework for runnin...
0.67.1               PSKoans                             PSGallery            A module designed to provide a crash-c...

Context "The Problematic Assertions"

In every koan that VScode opens, it reports a problem with Line 1:
using module PSKoans

In problems tab:
❌Could not find the module 'PSKoans'.

In a powershell 5.1 console window, commands like Show-Karma work just fine.

Context "Your Attempts"

I deleted the Pester and PSKoans folders from $env:HOMEPATH\Documents\WindowsPowerShell\Modules
I reinstalled PSKoans, and Pester with these commands, in an administrator window:

$names = "Pester", "PSKoans"
foreach( $name in $names){
    Install-Module -Name $name -Force -Scope AllUsers -AllowClobber
}

Context "Additional Information"

It may be possible I've installed it incorrectly, but I do not know how to debug it further.
I'm happy to provide you with any additional info you need.

The PSKoans have been wonderful in teaching me the finer details of powershell, over and above the everyday commands I use at work.

@doctrosix doctrosix added Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it! labels Feb 8, 2022
@vexx32
Copy link
Owner

vexx32 commented Feb 8, 2022

You may need to manually import the module into the PS Integrated Console that VS Code uses to run the PowerShell language server for using statements to work appropriately, I think. If that errors, it might give us a better indication as to why it can't find the module normally.

@doctrosix
Copy link
Author

Actions taken:
I opened VScode
I gave the Integrated console the command:
Import-Module PSKoans
then, in a separate 'Windows Powershell' console window I typed:
Show-Karma -Meditate
My latest Koan loaded in VScode. ( AboutArrays.Koans.ps1 )

The using error in VScode is still popping up

In the separate 'Windows Powershell' console window, I also tried typing:
using module PSKoans
no errors reported.

Here's my $env:PSModulePath:
C:\Users\mario\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules

PSkoans, and Pester are installed in:

C:\Program Files\WindowsPowerShell\Modules\PSKoans
C:\Program Files\WindowsPowerShell\Modules\Pester

I'm very happy to debug with you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it!
Projects
None yet
Development

No branches or pull requests

2 participants