Describe the bug
After switching Node to a low version (14.15.0) with vp env use, running vp i fails — but before failing it writes devEngines.packageManager = npm@11.17.0 into the project's package.json (with onFail: "download"), downloads npm 11.17.0, and routes every subsequent npm invocation to it. Because npm 11 requires Node ^20.17.0 || >=22.9.0 and uses require('node:path') (the node: prefix is not supported by Node 14's CommonJS loader), every npm command then crashes — including manual npm i / npm run dev, not just vp i. This breaks the project's toolchain connectivity even though the user never asked for an npm upgrade.
$ npm -v
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'node:path'
Require stack:
- ~/.vite-plus/package_manager/npm/11.17.0/npm/lib/cli.js
- ~/.vite-plus/package_manager/npm/11.17.0/npm/bin/npm-cli.js
The same Cannot find module 'node:path' is thrown by vp i, npm i, and npm run dev — they all hit the vp-managed npm 11.17.0.
Root cause
- No node↔npm compatibility check. When
vp env use pins Node to 14.15.0 (which ships npm 6.14.8), vp does not honor the bundled npm. Instead, on vp i it pins/writes npm@11.17.0 into devEngines, whose engines field is ^20.17.0 || >=22.9.0 — fundamentally incompatible with Node 14.
- Failed
vp i still writes side-effect config. vp i fails, yet leaves devEngines.packageManager behind in package.json, permanently routing npm to the incompatible npm 11.
Verified on disk:
package.json now contains:
"devEngines": { "packageManager": { "name": "npm", "version": "11.17.0", "onFail": "download" } }
- npm 11's
cli.js line 10: const cliEntry = require('node:path').resolve(...)
- npm 11's
package.json: "engines": { "node": "^20.17.0 || >=22.9.0" }
- Node 14.15.0:
require('node:path') → MODULE_NOT_FOUND
Expected
Scope
To be clear: I'm not asking Vite+ core to support old Node generally. The practical ask is narrower — on unsupported Node versions, provide vp i and vpr passthrough/shims so basic install + script-running still works on legacy enterprise projects that can't be upgraded. That covers the day-to-day project-development flow.
Reproduction
Any project under Node ≤ 16 with vp env use 14.15.0 (or similar low version), then vp i.
Steps to reproduce
vp env use 14.15.0 # node now 14.15.0 (bundles npm 6.14.8)
vp i # fails, but writes devEngines.npm@11.17.0 to package.json
npm -v # Cannot find module 'node:path'
npm i # Cannot find module 'node:path'
Recovery (manual): remove the devEngines block from package.json and avoid vp i on this Node.
System Info
$ vp --version
VITE+ - The Unified Toolchain for the Web
vp v0.2.1
Environment:
Package manager npm v11.17.0
Node.js v14.15.0 (.node-version)
$ vp env current
VITE+ - The Unified Toolchain for the Web
Environment:
Version 14.15.0
Source .node-version
Project Root <project>
Tool Paths:
node ~/.vite-plus/js_runtime/node/14.15.0/bin/node
npm ~/.vite-plus/js_runtime/node/14.15.0/bin/npm
npx ~/.vite-plus/js_runtime/node/14.15.0/bin/npx
Package Manager:
Name npm
Version 11.17.0
Source devEngines.packageManager
Source Path <project>/package.json
Bin Path ~/.vite-plus/package_manager/npm/11.17.0/npm/bin/npm
Note: vp --version / vp env current work fine (they don't spawn the npm binary); only commands that actually exec npm — vp i, npm, npm run <script> — crash.
Used Package Manager
npm
Logs
$ vp i
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'node:path'
Require stack:
- ~/.vite-plus/package_manager/npm/11.17.0/npm/lib/cli.js
- ~/.vite-plus/package_manager/npm/11.17.0/npm/bin/npm-cli.js
Related
Validations
Describe the bug
After switching Node to a low version (14.15.0) with
vp env use, runningvp ifails — but before failing it writesdevEngines.packageManager = npm@11.17.0into the project'spackage.json(withonFail: "download"), downloads npm 11.17.0, and routes every subsequentnpminvocation to it. Because npm 11 requires Node^20.17.0 || >=22.9.0and usesrequire('node:path')(thenode:prefix is not supported by Node 14's CommonJS loader), everynpmcommand then crashes — including manualnpm i/npm run dev, not justvp i. This breaks the project's toolchain connectivity even though the user never asked for an npm upgrade.The same
Cannot find module 'node:path'is thrown byvp i,npm i, andnpm run dev— they all hit the vp-managed npm 11.17.0.Root cause
vp env usepins Node to 14.15.0 (which ships npm 6.14.8), vp does not honor the bundled npm. Instead, onvp iit pins/writes npm@11.17.0 intodevEngines, whoseenginesfield is^20.17.0 || >=22.9.0— fundamentally incompatible with Node 14.vp istill writes side-effect config.vp ifails, yet leavesdevEngines.packageManagerbehind inpackage.json, permanently routingnpmto the incompatible npm 11.Verified on disk:
package.jsonnow contains:cli.jsline 10:const cliEntry = require('node:path').resolve(...)package.json:"engines": { "node": "^20.17.0 || >=22.9.0" }require('node:path')→MODULE_NOT_FOUNDExpected
vp ion an unsupported Node should not upgrade/npm-pin npm to a version incompatible with the active Node (use the Node-bundled npm, or pick a compatible npm version).vp ishould not leavedevEngines.packageManagerwritten into the project.vp icould degrade to a passthrough to the Node-bundled package manager — same shim idea proposed in bug: vite-plus@0.2.1 crashes on Node < 20.12 with "node:util has no export named styleText" before engine check #1909 forvpr, extended tovp i/ install.Scope
To be clear: I'm not asking Vite+ core to support old Node generally. The practical ask is narrower — on unsupported Node versions, provide
vp iandvprpassthrough/shims so basic install + script-running still works on legacy enterprise projects that can't be upgraded. That covers the day-to-day project-development flow.Reproduction
Any project under Node ≤ 16 with
vp env use 14.15.0(or similar low version), thenvp i.Steps to reproduce
Recovery (manual): remove the
devEnginesblock frompackage.jsonand avoidvp ion this Node.System Info
Note:
vp --version/vp env currentwork fine (they don't spawn the npm binary); only commands that actually exec npm —vp i,npm,npm run <script>— crash.Used Package Manager
npm
Logs
Related
vpron low Node. This issue is thevp icounterpart and a stricter bug:vp inot only fails, it poisonspackage.jsonand breaks manualnpmas well.Validations
devEnginesand downloads npm 11; npm 11 works correctly on its supported Node.