voidzero-dev / voidzero-dev/vite-plus
vpr appears not to preserve the pnpm lifecycle environment, causing npm-run-all2 to fall back to npm
- Langage dominant
- Rust
- Étoiles
- 5.8k
- Forks
- 262
- Merge moyen
- 23 h 18 min
- PR mergées (30 j)
- 139
Description
### Describe the bug
In a project configured to use pnpm, running a package script through `vpr` causes `npm-run-all2` / `run-p` to invoke child scripts with npm instead of pnpm.
The same script works correctly when launched with `pnpm run`.
The project declares pnpm as its package manager. When `run-p` is launched by pnpm, it correctly uses pnpm for the child scripts. When it is launched by `vpr`, it falls back to npm, which then fails with `EBADDEVENGINES` because the project only permits pnpm.
Expected behavior:
- `vpr check` should preserve enough package-manager lifecycle environment for child process runners to detect pnpm.
- Child scripts should be executed using pnpm, consistently with `pnpm run check`.
Actual behavior:
- `pnpm run check` succeeds.
- `vpr check` causes `run-p` to invoke npm for the child scripts.
- npm fails because `devEngines.packageManager` requires pnpm.
This appears to happen because the environment provided by `vpr` differs from the environment provided by `pnpm run`, particularly package-manager lifecycle variables such as `npm_execpath`.
A serial workaround that explicitly invokes pnpm works, but it loses parallel execution. In my project, the parallel command takes 3.94 seconds, while the serial workaround takes 6.35 seconds.
### Reproduction
https://github.com/bling-yshs/vue-demo/tree/archive/vp
### Steps to reproduce
1. Clone the reproduction repository.
2. Install dependencies:
```bash
vp i
```
3. Run the parallel script directly through pnpm:
```bash
pnpm run check
```
All three child scripts complete successfully.
4. Run the same script through Vite+:
```bash
vpr check
```
5. Observe that `npm-run-all2` invokes the child scripts using npm instead of pnpm. npm then exits with `EBADDEVENGINES` because the project declares pnpm in `devEngines.packageManager`.
### System Info
```shell
D:/code/Webstorm/vue-demo
$ vp env current
VITE+ - The Unified Toolchain for the Web
Environment:
Version 24.19.0
Source .node-version
Source Path D:\code\Webstorm\vue-demo\.node-version
Project Root D:\code\Webstorm\vue-demo
Tool Paths:
node C:\Users\yshs\.vite-plus\js_runtime\node\24.19.0\node.exe
npm C:\Users\yshs\.vite-plus\js_runtime\node\24.19.0\npm.cmd
npx C:\Users\yshs\.vite-plus\js_runtime\node\24.19.0\npx.cmd
Package Manager:
Name pnpm
Version 11.20.0
Source devEngines.packageManager
Source Path D:\code\Webstorm\vue-demo\package.json
Project Root D:\code\Webstorm\vue-demo
Bin Path C:\Users\yshs\.vite-plus\package_manager\pnpm\11.20.0\pnpm\bin\pnpm.cmd
D:/code/Webstorm/vue-demo
$ vp --version
VITE+ - The Unified Toolchain for the Web
vp v0.2.7
Local vite-plus:
vite-plus v0.2.7
Tools:
vite v8.1.5
rolldown v1.2.0
vitest v4.1.10
oxfmt v0.60.0
oxlint v1.75.0
oxlint-tsgolint v7.0.2001
tsdown v0.22.14
Environment:
Package manager pnpm v11.20.0
Node.js v24.19.0 (.node-version)
```
### Used Package Manager
pnpm
### Logs
```shell
```
### Validations
- [x] Read the [Contributing Guidelines](https://github.com/voidzero-dev/vite-plus/blob/main/CONTRIBUTING.md).
- [x] Check that there isn't [already an issue](https://github.com/voidzero-dev/vite-plus/issues) for the same bug.
- [x] Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez le comportement avec le dépôt vue-demo lié en comparant `pnpm run check` et `vpr check`. Suivez la manière dont `vpr` fournit des variables du cycle de vie du gestionnaire de paquets telles que `npm_execpath`, puis vérifiez que `npm-run-all2` lance les scripts enfants avec pnpm et que la commande parallèle réussit sans `EBADDEVENGINES`.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, rust
- Domaine
- cli, tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 58/100