Repository navigation
fix(nodeenv): skip node.js pre-releases for latest and ranges - #454
Merged
Merged
Conversation
nodejs.org now lists v27.0.0-alpha.0.0.0 first in index.json. latest took the first entry with a build for the platform, and semver ranges ran parse_version on every entry, so both stopped with a ValueError on '0-alpha' before anything was downloaded. Both now skip pre-releases, and parse_version drops a '-' suffix of the patch part as it already drops '+', so an exact pre-release given with --node installs. Fixes #453
ekalinin
added a commit
to jihtsan/nodeenv
that referenced
this pull request
Oct 29, 2026
The integration, git-bash and with-npm-windows jobs failed on 6d6b79b because master did not have the ekalinin#453 fix yet: latest resolved to 27.0.0-alpha.0.0.0 and crashed in parse_version. Master now has it (ekalinin#454) and keeps the ekalinin#453 entry in its 1.11.1 section (ekalinin#455), so the merge has no conflicts.
4 of 10 tasks
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.
Fixes #453
What happens
Since 2026-10-29 the first entry of nodejs.org's
index.jsonisv27.0.0-alpha.0.0.0. Two paths pick versions from that index, and both stop withValueError: invalid literal for int() with base 10: '0-alpha'before anything is downloaded:latest, the default:_get_last_node_version()takes the first entry with a build for the platform, so it returns the alpha, andparse_version()fails on it increate_environment().--node=26or--node='*':resolve_node_version()runsparse_version()on every entry of the index, the alpha included. The issue does not mention this path.Reproduced on master. The 1.11.0 release has the same code. It also fails the
integration,git-bashandwith-npm-windowsCI jobs, which use the default version, on every pull request (seen on #431).What changes
_is_prerelease()treats a version with a-as a pre-release._get_last_node_version()andresolve_node_version()skip such entries, solatestand ranges resolve to stable releases only, as README and--helpdescribelatest.parse_version()drops a-...suffix of the patch part, as it already drops+.... An exact pre-release such as--node=27.0.0-alpha.0.0.0installs instead of crashing.The
parse_version()change alone is not enough:resolve_node_version('*')then returns27.0.0, which does not exist on nodejs.org.Tests
The new tests fail on master and pass with the fix:
test_get_latest_node_version_skips_prereleaseandtest_resolve_node_version_skips_prereleaseuse the newmock_index_json_alphafixture, which puts the real alpha entry from today'sindex.jsonin front ofnodejs_index.json;test_parse_versiongets a case forv27.0.0-alpha.0.0.0.The integration tests pass locally against the real nodejs.org (8 passed, 3 skipped: Windows only), and
nodeenv --prebuilt -n 27.0.0-alpha.0.0.0installs a node that reportsv27.0.0-alpha.0.0.0.