Skip to content

Managed Node.js loses PATH precedence during vp install #3492

Open

Description

@ywenhao

Describe the bug

With Node managed mode enabled, vp install can run dependency engine checks and lifecycle scripts with an older Node.js than the version selected by the project. This happens when the managed runtime's bin directory is already on PATH after another Node.js bin directory.

In the reproduction, vp env current reports Node 26.13.1 from .nvmrc and managed mode. With Node 24.22.3 ahead of that bin directory, vp install emits an Unsupported engine warning and runs postinstall under 24.22.3.

In managed mode, I expect vp install to give the selected Node.js precedence for dependency checks and lifecycle scripts. Shell CI jobs need that behavior to be consistent when they inherit a PATH with several Node installations.

Reproduction

Runnable Bash reproduction

Steps to reproduce

  1. On Linux with Vite+ 1.7.0, enable Node managed mode with vp env on node.
  2. Download repro.sh and run bash repro.sh. It creates a temporary project, pins Node 26.13.1, and packages a local test dependency that requires Node >=26.
  3. Compare vp install and vp env exec --node 26.13.1 -- pnpm install in the script. Both use the same inherited PATH and the same pnpm version. The explicit invocation uses the pinned Node for postinstall and clears the engine warning.

System Info

Linux x86_64 (Ubuntu on WSL). Home directory abbreviated.

Node.js:
  Version    26.13.1
  Source     .nvmrc
  Bin Path   $HOME/.vite-plus/js_runtime/node/26.13.1/bin/node
  Installed  true
  Mode       managed

Package Manager:
  Name       pnpm
  Version    12.21.0
  Source     packageManager
  Bin Paths
    pnpm     $HOME/.vite-plus/package_manager/pnpm/12.21.0/pnpm/bin/pnpm
    pnpx     $HOME/.vite-plus/package_manager/pnpm/12.21.0/pnpm/bin/pnpx
  Installed  true
  Mode       managed

vp v1.7.0

Local vite-plus:
  vite-plus  Not found

Tools:
  vite             Not found
  rolldown         Not found
  vitest           Not found
  oxfmt            Not found
  oxlint           Not found
  oxlint-tsgolint  Not found
  tsdown           Not found

Environment:
  Package manager  pnpm v12.21.0
  Node.js          v26.13.1 (.nvmrc)

Used Package Manager

pnpm 12.21.0

Logs

Reproduction with Node 24 before the pinned Node 26 on PATH
[WARN] Unsupported engine for engine-check@file:engine-check.tgz: wanted: {"node":">=26"} (current: {"node":"24.22.3"})
. postinstall$ node --version
. postinstall: v24.22.3

Control with an explicit Node version and the same PATH
. postinstall$ node --version
. postinstall: v26.13.1

The Node path setup for vp install passes PrependOptions { dedupe_anywhere: true }. A later occurrence of the selected bin directory can satisfy that check while a different node still wins the lookup. PATH setup in v1.7.0

Validations

  • Read the Contributing Guidelines.
  • Searched open and closed issues for the same bug.
  • Isolated the discrepancy to Vite+'s handling of PATH using the same pnpm and Node pins.
  • Verified the minimal reproduction on Linux.

Activity

  1. added theissue type on Nov 19, 2026
  2. ywenhao commented on Nov 19, 2026

    @ywenhao
    ContributorAuthor

    I also reproduced this on a Linux GitLab Shell runner with Node managed and pnpm set to system-first.

    • Vite+ 1.7.0, Node 26.13.1 in .nvmrc, and pnpm 12.21.0 in package.json.
    • The inherited PATH contains only the system bin directories (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin). Both system pnpm 12.21.0 and system Node 20.19.5 are in /usr/bin.
    • vp --version reports Node 26.13.1 from .nvmrc.

    With a local test dependency requiring Node >=26, vp install --frozen-lockfile produced this output.

    [WARN] Unsupported engine for engine-check@file:engine-check: wanted: {"node":">=26"} (current: {"node":"20.19.5"})
    . postinstall: v20.19.5 /usr/bin/node
    

    On a fresh copy of the same fixture, vp env exec --node 26.13.1 --package-manager pnpm@12.21.0 -- pnpm install --frozen-lockfile passed the engine check and postinstall printed v26.13.1 from the managed runtime.

    I reproduced the same behavior locally with an isolated Vite+ config and a directory containing an older Node binary alongside a system pnpm binary. Switching only pnpm to managed mode with vp env on pnpm made vp install use the project Node in that setup.

    The package-manager dispatch prepends the selected package manager's bin directory when creating the child environment. With system pnpm this moves /usr/bin ahead of the managed Node directory. This can change Node selection even when the incoming PATH contains only system directories. Package-manager dispatch in v1.7.0

  3. voidzero-bot commented on Nov 19, 2026

    @voidzero-bot
  4. self-assigned this
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

- P4: importantViolates documented behavior or significantly affects performance (priority)

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions