`npm install -g` keeps the `bin` link on the old version after the default Node.js changes
Les mainteneurs répondent en général sous 1 jour
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Describe the bug
When Vite+ manages Node.js, npm install -g <pkg> installs the package into the prefix of the active Node.js version. Vite+ then links the package binary into ~/.vite-plus/bin/ and records the owner in ~/.vite-plus/bins/<bin>.json.
When the active Node.js version changes (for example, the latest LTS moves from 24 to 26), I run npm install -g <pkg> again to update the package. npm installs a new copy into the new Node.js prefix and reports success. But the link in ~/.vite-plus/bin/ still points to the copy in the old Node.js prefix. Vite+ shows no message. When I run the command, I get the old version.
Expected: the link points to the copy that npm just installed, or Vite+ tells me that it kept the old link.
Cause: in check_npm_global_install_result, Vite+ replaces an existing link only when a different npm package owns it. When the same package owns it, Vite+ skips it, and it does not compare the link target with the new npm bin directory:
Possible fix: also replace the link when the same package owns it but the link target is not in the current npm bin directory. Write the new nodeVersion to the bin config, and print a line such as Relinked 'agent-browser' to Node.js 26.13.0 (was 24.15.0).
I can submit a PR for this fix.
Related: #1986 (general discussion about npm install -g and Node.js version management).
Reproduction
No repository is necessary. This is global CLI behavior. See the steps below.
Steps to reproduce
# 1. Install a package with an older default Node.js version
vp env default 24
npm install -g cowsay # Answer "Y" to create the link
ls -l ~/.vite-plus/bin/cowsay # -> .../js_runtime/node/24.x.y/bin/cowsay
# 2. Change the default Node.js version, then install the package again
vp env default 26
npm install -g cowsay # npm reports success; Vite+ prints nothing
ls -l ~/.vite-plus/bin/cowsay # Still -> .../node/24.x.y/bin/cowsay
cat ~/.vite-plus/bins/cowsay.json # "nodeVersion" is still 24.x.y
# The new copy exists, but the link does not use it
ls ~/.vite-plus/js_runtime/node/26.*/lib/node_modules/cowsay
Workaround: remove the link (rm ~/.vite-plus/bin/cowsay), then run npm install -g cowsay again; or run vp install -g instead of npm install -g.
On my machine, 7 links point to old Node.js versions (24.15.0, 24.18.0, 24.21.0), while the active version is 26.13.0.
System Info
$ vp env current
Environment:
Version 26.13.0
Source lts
Tool Paths:
node /Users/user/.vite-plus/js_runtime/node/26.13.0/bin/node
npm /Users/user/.vite-plus/js_runtime/node/26.13.0/bin/npm
npx /Users/user/.vite-plus/js_runtime/node/26.13.0/bin/npx
$ vp --version
vp v0.2.1
Local vite-plus:
vite-plus Not found
Environment:
Package manager Not found
Node.js v26.13.0
macOS, npm 10.9.9. The code at the link above is from current main (7073d613), so the bug is also on main.
Used Package Manager
npm
- Langage dominant
- Rust
- Étoiles
- 6.5k
- Forks
- 296
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 230
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de voidzero-dev/vite-plus
-
pending triage
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
voidzero-dev/vite-plus#3235 ·
Les mainteneurs répondent en général sous 1 jour
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterPeut-être pris @kshanxs l’a pris il y a 5 jours. Ouvertedocumentation
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
voidzero-dev/vite-plus#3219 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
pending triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
voidzero-dev/vite-plus#2882 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepoPeut-être pris @voidzero-bot l’a pris aujourd’hui. Ouverte- P2: has workaround pending triage triage: fix verified
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
voidzero-dev/vite-plus#3281 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
☂️ Plan for 2026 Q4Ouvertetriage: not actionable
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
voidzero-dev/vite-plus#3277 · 1 commentaire · 3 réactions ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de voidzero-dev/vite-plus
Issues similaires
-
good first issue help wanted r-docs
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
servo/rust-smallvec#824 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
superradcompany/microsandbox#1974 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
priority middle
Difficulté 1/5 Moins d'une heure Accessibilité débutants 62/100
KATO-Hiro/AtCoderClans#12940 ·
Les mainteneurs répondent en général sous 1 jour