Please feel free to provide feedback or file bugs here.

#Requires -Module error is confusing when version fails

When a #Requires -Module version requirement (ModuleVersion, MaximumVersion, RequiredVersion) is not satisfied, the error message says that the module isn't found, not that the *version* of the module isn't found.

This is potentially very confusing.

& : The script 'Module.Help.Tests.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Pester.
At C:\ps-test\Test-PesterScriptParameter.ps1:18 char:3
+ & $TestPath -ModuleName PSScriptAnalyzer
+ ~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Module.Help.Tests.ps1:String) [], ScriptRequiresException
+ FullyQualifiedErrorId : ScriptRequiresMissingModules

14 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    June Blender shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base