Skip to content

Can't import the module first time under PS 5.1 #166

@NowinskiK

Description

@NowinskiK

Problem description

I'm trying to import the module using PS 5.1

Verbose logs

PS C:\Users\kno> import-module fabricTools
At C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\FabricTools.psm1:453 char:49
+         $ObjectIdOrName = $Response.DisplayName ? $Response.DisplayNa ...
+                                                 ~
Unexpected token '?' in expression or statement.
At C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\FabricTools.psm1:2888 char:39
+             ObjectIdOrName = $StageId ? $StageId : $DeploymentPipelin ...
+                                       ~
Unexpected token '?' in expression or statement.
At C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\FabricTools.psm1:2888 char:38
+             ObjectIdOrName = $StageId ? $StageId : $DeploymentPipelin ...
+                                      ~
The hash literal was incomplete.
At C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\FabricTools.psm1:2889 char:10
+         }
+          ~
The Try statement is missing its Catch or Finally block.
At C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\FabricTools.psm1:2899 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

import-module : The module to process 'FabricTools.psm1', listed in field 'ModuleToProcess/RootModule' of module manifest
'C:\Users\kno\Documents\WindowsPowerShell\Modules\fabricTools\0.30.0\fabricTools.psd1' was not processed because no valid module was found in any module directory.
At line:1 char:1
+ import-module fabricTools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (fabricTools:String) [Import-Module], PSInvalidOperationException
    + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

How to reproduce

Import-Module FabricTools under PS 5.1

Expected behavior

The module will be imported, or documentation clearly says it works only under PS 7.x

Current behavior

Fails when trying to import.

Suggested solution

TBD

Operating system you are running FabricTools on

Windows 11
PS 5.1

PowerShell version and build the target node is running

PS 5.1

Module version used

0.30

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions