Repository navigation
Description
Describe the bug
I created a monorepo using vp create vite:monorepo --package-manager npm. The root package.json defines an override like this:
"overrides": {
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0"
}When I added a package that depends on vite to a new, empty workspace member, npm didn't apply this override. Instead, it installed upstream vite@8.3.8 under node_modules/vitepress/node_modules/vite and wrote that to package-lock.json. Running vp install afterward didn't fix it either. I only got the override to work after deleting node_modules and package-lock.json and running a clean install.
Because npm didn't throw any errors and the build succeeded, it's very easy to miss that the package is actually running upstream Vite.
This seems like an npm issue. I tested a plain npm workspace with just the root override on npm 11.20.0 and 12.2.2, and ran into the exact same behavior. Still, I wanted to bring it up here since it impacts Vite+ monorepos using npm. From what I can tell, #1728 verified fresh installs across npm, yarn, and bun, but this scenario is a bit different because the package is added later with npm install <pkg>.
For context, I couldn't reproduce this when:
- Adding
vitepresstoapps/website, which already depends onvite-plus - Testing a standalone project created with
vp create vite:application --package-manager npm, which has a directvitedependency at the root
Reproduction
https://github.com/naokihaba/npm-overrides-first-install-repro
Steps to reproduce
git clone https://github.com/naokihaba/npm-overrides-first-install-repro
cd npm-overrides-first-install-repro
./repro.shThe script needs the global vp CLI. It creates the monorepo in a temporary directory and does these steps:
- Run
vp create vite:monorepo --package-manager npm. - Add an empty workspace member
apps/docs, and runvp install. - Run
vp add -D vitepress@2.0.0-alpha.21 --filter docs.vitepressdepends onvite@^8.3.4. - Run
vp installagain with no changes. - Remove
node_modulesandpackage-lock.json, and runvp install.
After steps 3, 4, and 5, the script prints the package that vite resolves to from vitepress:
3. vp add -D vitepress@2.0.0-alpha.21 --filter docs (first time vitepress enters the tree)
vite -> vite@8.3.8
path: node_modules/vitepress/node_modules/vite/package.json
overrides applied: NO
4. vp install (again, no changes to package.json)
vite -> vite@8.3.8
path: node_modules/vitepress/node_modules/vite/package.json
overrides applied: NO
5. Remove node_modules and package-lock.json, then vp install
vite -> @voidzero-dev/vite-plus-core@1.5.0
path: node_modules/vite/package.json
overrides applied: yes
System Info
$ vp env current
Node.js:
Version 26.13.1
Source engines.node
Bin Path ~/.vite-plus/js_runtime/node/26.13.1/bin/node
Installed true
Mode managed
Package Manager:
Name npm
Version 12.2.2
Source devEngines.packageManager
Bin Paths
npm ~/.vite-plus/package_manager/npm/12.2.2/npm/bin/npm
npx ~/.vite-plus/package_manager/npm/12.2.2/npm/bin/npx
Installed true
Mode managed
$ vp --version
vp v1.5.0
Local vite-plus:
vite-plus v1.5.0
Tools:
vite v8.3.5
rolldown v1.2.16
vitest v5.1.0
oxfmt v0.76.0
oxlint v1.91.0
oxlint-tsgolint v7.0.2005
tsdown v0.23.4
Environment:
Package manager npm v12.2.2
Node.js v26.13.1 (engines.node)
macOS 27.0, arm64Used Package Manager
npm
Logs
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Effort
Target date
Start date
Activity
voidzero-bot commentedon Nov 14, 2026
vp create/vp addsequence; no focused test was added during triage.vite-dependent package to a new, empty member), and the reporter already documented a reliable workaround: removingnode_modulesandpackage-lock.jsonand running a clean install restores the override.On current
mainwith npm 12.2.2, I could not reproduce the reported behavior. After creating an npm monorepo, adding an emptyapps/docsmember, and runningvp add -D vitepress@2.0.0-alpha.21 --filter docs, the rootviteoverride resolved to@voidzero-dev/vite-plus-coreimmediately, with no upstreamvitenested undervitepress. Re-runningvp installand performing a clean install both kept the override. The reporter noted the same symptom occurs in a plain npm workspace, which suggests the original failure was driven by an upstream npm lockfile quirk that is no longer triggered (or is masked) in the current Vite+/npm combination tested here.This issue appears to have already been fixed. Try upgrading to the latest Vite+ release (
vp upgradeor reinstall the globalvpCLI) and running a clean install in the affected monorepo. If the behavior still occurs after that, please include the output ofvp --version,node -v, andnpm -vfrom the affected project.Full Triage Report
Triage Report: #3455
Issue Summary
In a Vite+ npm monorepo, the root
overridesentry that redirectsviteto ascoped replacement package may not be applied when a new, empty workspace member
adds a package that depends on
vite. The reporter observed thatvitepressadded to
apps/docsresolved to upstreamvite@8.3.8undernode_modules/vitepress/node_modules/vite, and only a clean install(
rm -rf node_modules package-lock.json && npm install) corrected the tree.The reporter also verified the same behavior in a plain npm workspace without
Vite+, suggesting this is an upstream npm issue.
Environment Used
vpCLI: v1.6.0 (built from current checkout ofmain)vite-plus: v1.6.0vpfor the created monorepo;devEngines.packageManagerpinned npm to 12.2.2)https://github.com/naokihaba/npm-overrides-first-install-repro
Reproduction Path
Started from the Vite+ checkout on the branch
triagebot/fix-3455.Because the current
maintemplate overridesviteto@voidzero-dev/vite-plus-core@8.3.8000, an unpublished development version, thepublic registry would fail during install. To keep the reproduction focused on
the override behavior rather than a missing-package error, all npm-using
commands were run through the local registry helper so that
@voidzero-dev/vite-plus-core@8.3.8000resolved from the checkout packages.Commands executed:
Create the monorepo:
Add an empty workspace member
apps/docsand install:Add
vitepress@2.0.0-alpha.21toapps/docs:Run
check.tsfrom the reproduction repository:Run
vp installagain with no changes:Clean install as a control:
Result
The reported behavior did not reproduce on the current checkout:
vitepressto the new empty member, the override was appliedimmediately.
node_modules/viteappeared undervitepress.vp installwithout changes kept the override.package-lock.jsonrecorded the override target(
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000").Early-Exit Considerations
None of the skip reasons applied:
runner (
vpdownloaded npm 12.2.2 on demand).Observations
mainbecause the template pins@voidzero-dev/vite-plus-core@8.3.8000,which is not published. The local registry wrapper was required to keep the
test focused on override application rather than a missing-package failure.
the issue may be an upstream npm formatting/lockfile bug that does not
trigger on every environment or npm version. Differences that could matter
include platform (macOS vs Linux) or subtle npm patch-level behavior that
has since changed.
main, Vite+ monorepos created withnpmdo not appear toexhibit the reported failure.
Triage Conclusion
main.or may depend on a specific npm/platform state. A maintainer could ask the
reporter to re-test with the latest Vite+ and npm, or to confirm whether the
behavior still reproduces in a plain npm workspace under the same conditions.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
naokihaba commentedon Nov 14, 2026
The cause is npm/cli#4834. When a workspace member adds a dependency and a
package-lock.jsonalready exists, npm does not apply the rootoverridesto that dependency. This must be fixed in npm.Vite+ will not add a workaround. A workaround would have to change how npm writes the lockfile or installs packages, and the impact is small:
vitepress buildstill works with upstream Vite.Until npm fixes the bug, delete
package-lock.jsonandnode_modules, then runvp installagain. A fresh install applies the override.I will keep this issue open to track npm/cli#4834.
voidzero-bot commentedon Nov 14, 2026
Automated triage could not be completed: the triage report (
report.md) is missing or could not be read. Please inspect the triage run artifacts and logs for the reproduction, diagnosis, and verification results.