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

Powershell version hell #15

Open
OpNop opened this issue Feb 3, 2021 · 1 comment
Open

Powershell version hell #15

OpNop opened this issue Feb 3, 2021 · 1 comment

Comments

@OpNop
Copy link
Contributor

OpNop commented Feb 3, 2021

Just ran into this when running the automated script

Started running it in normal PowerShell that comes with windows (5.1.19041.610) as of windows 10 20H2
ran Import-Module BhudLib and got the errors saying it needed PS version 6.0 or higher

Import-Module : The version of Windows PowerShell on this computer is '5.1.19041.610'. The module 'C:\Program
Files\WindowsPowerShell\Modules\BhudLib\1.0.0\BhudLib.psd1' requires a minimum Windows PowerShell version of '6.0' to
run. Verify that you have the minimum required version of Windows PowerShell installed, and then try again.
At line:1 char:1
+ Import-Module BhudLib
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Program File....0\BhudLib.psd1:String) [Import-Module], Invalid
   OperationException
    + FullyQualifiedErrorId : Modules_InsufficientPowerShellVersion,Microsoft.PowerShell.Commands.ImportModuleCommand

Had PS6 installed so moved over to it, and try and run Import-Module BhudLib and get error saying I need PS7 now

. : The script 'BhudModuleLib.ps1' cannot be run because it contained a "#requires" statement for PowerShell 7.0. The version of PowerShell that is required by the script does not match the currently running version of PowerShell 6.1.3.
At C:\Program Files\PowerShell\Modules\BhudLib\1.0.0\BhudLib.psm1:3 char:3
+ . "$PSScriptRoot\BhudModuleLib.ps1"
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (BhudModuleLib.ps1:String) [], ScriptRequiresException
+ FullyQualifiedErrorId : ScriptRequiresUnmatchedPSVersion

At C:\Program Files\PowerShell\Modules\BhudLib\1.0.0\BhudPkgLib.ps1:18 char:22
+     BhudPkgManifest([BhudModule] $module, [String] $downloadUrl) {
+                      ~~~~~~~~~~
Unable to find type [BhudModule].
At C:\Program Files\PowerShell\Modules\BhudLib\1.0.0\BhudPkgLib.ps1:29 char:32
+     [Void] PopulateFromModule([BhudModule] $module) {
+                                ~~~~~~~~~~
Unable to find type [BhudModule].
+ CategoryInfo          : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : TypeNotFound

I recommend putting a note in readme that says to just use PS7

@dlamkins
Copy link
Member

dlamkins commented Feb 4, 2021

Good idea. Looks like I also have a mismatch of the requirement statements compared to the psm1 files.

PowerShellVersion = '6.0'

#requires -Version 6.0

#Requires -Version 7.0

#requires -Version 6.0

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

2 participants