Skip to content

fix: guard FORCE_NODE_VERSION in the version error path - #7983

Merged
code-asher merged 1 commit into
coder:mainfrom
denusklo:fix-force-node-version-unbound
Sep 4, 2026
Merged

fix: guard FORCE_NODE_VERSION in the version error path#7983
code-asher merged 1 commit into
coder:mainfrom
denusklo:fix-force-node-version-unbound

Conversation

@denusklo

@denusklo denusklo commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Installing on an unsupported node version dies with FORCE_NODE_VERSION: unbound variable instead of the intended error message. npm-postinstall.sh runs under set -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.

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.
@denusklo
denusklo requested a review from a team as a code owner September 4, 2026 04:56

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find, thank you!

@code-asher
code-asher merged commit 11699e6 into coder:main Sep 4, 2026
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.

2 participants