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

Fix systemroot inconsistent casing (Fixes #292) #299

Closed
wants to merge 1 commit into from

Conversation

Codex-
Copy link

@Codex- Codex- commented Feb 27, 2023

Long time no PR, sindresorhus 😄

This PR simply adds a fallback for casing differences in SYSTEMROOT across windows versions, currently when using this on W11 (at least the 3 versions I tested) SYSTEMROOT was undefined, however SystemRoot is defined.

So, try and use both

Fixes #292

@Codex- Codex- changed the title Fix systemroot inconsistent casing Fix systemroot inconsistent casing (Fixes#292) Feb 27, 2023
@Codex- Codex- changed the title Fix systemroot inconsistent casing (Fixes#292) Fix systemroot inconsistent casing (Fixes #292) Feb 27, 2023
@sindresorhus
Copy link
Owner

On Windows operating systems, environment variables are case-insensitive.

@Codex-
Copy link
Author

Codex- commented Feb 27, 2023

I read that too, however it doesn't seem to always be the case for all env vars:
image

PS C:\dev\bfp-app\packages\app> node -v    
v16.19.1
PS C:\dev\bfp-app\packages\app> npm -v     
9.5.1

I don't normally develop on windows, so this is on a fresh installation of w11 on a VM too

@sindresorhus
Copy link
Owner

Then open an issue on Node.js and add a code comment above your code change with a link to the Node.js issue. I prefer to only add workarounds when there's a chance it will be fixed properly at some point.

@Codex-
Copy link
Author

Codex- commented Feb 28, 2023

No problem, thanks anyway

@Codex- Codex- closed this Feb 28, 2023
@sindresorhus
Copy link
Owner

Why are you closing?

@Codex- Codex- deleted the fallback_systemroot branch March 1, 2023 04:32
@Codex-
Copy link
Author

Codex- commented Mar 1, 2023

Why are you closing?

I'm unable to consistently reproduce this in a blank sandboxe, so I'm assuming that it must be some combination of our code and environment causing this as opposed to node or otherwise. If I find a more consistent reproduction in node, I'll re-open with an issue, until then I'm going to assume it's a me problem :)

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

Successfully merging this pull request may close these issues.

error - uncaughtException: Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
2 participants