fix: guard FORCE_NODE_VERSION in the version error path - #7983
Open
denusklo wants to merge 1 commit into
Open
Conversation
Installing on the wrong node version dies with "FORCE_NODE_VERSION: unbound variable" instead of explaining itself. The script runs under set -u and this is the one place the variable is read bare; the three other reads all default it. The lines it never reaches are the ones telling you the override exists and naming it, so the people who most need that message are the only ones who cannot see it. Verified on Windows 11 with node 22 and code-server 4.135.0: before, the install ends at the unbound variable; after, it prints the version error and the override instructions, and exits as intended.
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.
Installing on an unsupported node version dies with
FORCE_NODE_VERSION: unbound variableinstead of the intended error message. npm-postinstall.sh runs underset -u, and this is the one place the variable is read bare; the other reads all default it with${FORCE_NODE_VERSION:-}.The lines the script never reaches are exactly the ones that tell the user the override exists and how to set it, so the people who need the message are the only ones who cannot see it.
Verified on Windows 11 with node 22 against 4.135.0: before, the install ends at the unbound variable; after, it prints the version error plus the override instructions and exits 1 as intended. Related to the install paths discussed in #1397.