Skip to content

assert minimum powershell version #1385

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

Merged
merged 3 commits into from
Mar 25, 2025
Merged

Conversation

simonLeary42
Copy link
Contributor

@simonLeary42 simonLeary42 commented Feb 16, 2025

when running direnv on an older version of powershell, every new shell produces this error:

Unable to find type [LocationChangedEventArgs].
At line:1 char:81
+ ... .Automation;  $hook = [EventHandler[LocationChangedEventArgs]] {   pa ...
+                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (LocationChangedEventArgs:TypeName) [], RuntimeExcep
   tion
    + FullyQualifiedErrorId : TypeNotFound

The property 'LocationChangedAction' cannot be found on this object. Verify that the property exists
and can be set.
At line:1 char:647
+ ...  } else {   $ExecutionContext.SessionState.InvokeCommand.LocationChan ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

this would be nicer:

PS /Users/simon> Invoke-Expression "$(/tmp/direnv-install/bin/direnv hook pwsh)"
Exception: direnv: powershell version 7.5.0 does not meet the minimum required version 8!

note that the minimum version is 7, the above output was made on my machine with a bogus minimum greater than what I had installed

@simonLeary42
Copy link
Contributor Author

@zimbatm zimbatm merged commit 1dc9bb7 into direnv:master Mar 25, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants