Skip to content

Avoid reinstalling a matching pinned Node version - #371

Open
Motaghi wants to merge 2 commits into
RobertCraigie:mainfrom
Motaghi:contrib/319-reuse-pinned-node
Open

Motaghi wants to merge 2 commits into
RobertCraigie:mainfrom
Motaghi:contrib/319-reuse-pinned-node

Conversation

@Motaghi

@Motaghi Motaghi commented Nov 2, 2026

Copy link
Copy Markdown

When PYRIGHT_PYTHON_NODE_VERSION is set, nodeenv currently installs with --force even when the requested Node version is already installed. Probe the installed Node executable before reinstalling, including when resolving npm, and reuse it only for a matching complete version. The probe has a five-second timeout; aliases, version changes, missing binaries, and failed or ambiguous probes retain installation.

Fixes #319.

Validation:

  • All 28 focused nodeenv tests pass, including eight reuse cases that fail against the original source.
  • Ruff, formatting, Pyright, and diff whitespace checks pass.
  • A separate process-level check verifies matching-version reuse and installation after a requested-version change without network access.

The full-suite run before the timeout-test follow-up had 66 passing tests and one unchanged Node 13.1.0 test failing with Bad CPU type on macOS arm64. The same test fails against the original production source. The supported OS/Python runtime matrix has not been run locally.

AI-assisted contribution.

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.

PYRIGHT_PYTHON_NODE_VERSION forces NodeJS installation on every "python -m pyright" execution

1 participant