Repository navigation
Conversation
Signed-off-by: PerryLink <255665900+PerryLink@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When node-gyp is started from a Visual Studio command prompt that exports
VisualStudioVersionbut not
VSCMD_VER, the VS discovery path reports that Visual Studio is not installed:This is the state described in issue #3276 (
VCINSTALLDIRandVisualStudioVersionset,VSCMD_VERabsent). On machines where theFind-VisualStudio.csPowerShell fallback is unavailable(restricted language mode, execution policy, no
VSSetupmodule) discovery then fails outright.The change
lib/find-visualstudio.js:148— fall back to the documentedVisualStudioVersionvariable whenVSCMD_VERis missing:Behaviour is unchanged when
VSCMD_VERis present, and unchanged when neither variable is set.Verification
Real VS2022 Build Tools 17.14.37314.3 on this machine,
--no-powershellso the fallback cannot maskthe problem:
v143, SDK10.0.26100.0.New unit test (
run on a VS Command Prompt that only exports VisualStudioVersion) fails before andpasses after;
test/test-find-visualstudio.js44/44; eslint clean.Note: when the PowerShell fallback is available, the same environment still eventually resolves VS
— so the visible symptom there is the misleading
unknown version "undefined"line rather than ahard failure. The patch removes the fast path's dependency on PowerShell either way.
DCO: commit is signed off, per CONTRIBUTING.md.