Skip to content

[email protected] pins [email protected] while its optional peer @vitest/browser-playwright resolves to a newer 4.1.11, causing an unresolvable ERESOLVE on fresh install #2531

Closed

Description

@smiggleworth

Summary

[email protected] depends on [email protected] (exact) and peer-depends on @vitest/browser-playwright: "4.1.10" (exact). @vitest/[email protected] — the latest published version on the registry, and the version npm's resolver reaches for when nothing else in the tree pins it — itself peer-requires [email protected] (exact). Because nothing else in a typical consumer's tree pins @vitest/browser-playwright or vitest to a specific version, npm's resolver ends up needing vitest to simultaneously satisfy two mutually exclusive exact-version peer requirements and fails with ERESOLVE.

Environment

  • vite-plus: 0.2.9
  • npm: 12.0.2
  • Node: v26.5.0

Steps to reproduce

  1. In a fresh project with "vite-plus": "^0.2.9" as the only relevant devDependency (no direct vitest or @vitest/browser-playwright pin), run:
    rm -rf node_modules package-lock.json
    npm install
    
  2. Observe:
    npm error code ERESOLVE
    npm error ERESOLVE could not resolve
    npm error
    npm error While resolving: <pkg>@undefined
    npm error Found: [email protected]
    npm error node_modules/vite-plus
    npm error   dev vite-plus@"^0.2.9" from the root project
    npm error   peerOptional vite-plus@"*" from [email protected]
    npm error   node_modules/oxfmt
    npm error     oxfmt@"=0.61.0" from [email protected]
    npm error   2 more (oxlint, @askrjs/vite)
    npm error
    npm error Could not resolve dependency:
    npm error dev vite-plus@"^0.2.9" from the root project
    npm error
    npm error Conflicting peer dependency: [email protected]
    npm error node_modules/vitest
    npm error   peer vitest@"4.1.11" from @vitest/[email protected]
    npm error   node_modules/@vitest/browser-playwright
    npm error     peerOptional @vitest/browser-playwright@"4.1.11" from [email protected]
    

Confirmed via npm view [email protected] dependencies:

dependencies = {
  ...
  vitest: '4.1.10',
  ...
}
peerDependencies = {
  '@vitest/browser-playwright': '4.1.10',
  '@vitest/browser-webdriverio': '4.1.10'
}

and npm view @vitest/browser-playwright versions confirms 4.1.11 is published and is the version npm's resolver prefers absent an explicit pin.

Expected

npm install with no other version pins in the consuming project resolves cleanly against [email protected]'s stated dependency/peer graph.

Actual

npm install fails outright with ERESOLVE; the only workarounds are --legacy-peer-deps/--force (accepting an unverified resolution) or the consumer adding an overrides entry pinning @vitest/browser-playwright to 4.1.10 themselves.

Requirements

  • vite-plus's own peerDependencies range for @vitest/browser-playwright (and any other split peer like it) is wide enough to include whatever versions of that peer are compatible, OR vite-plus pins/bundles a consistent, mutually-resolvable set itself so a bare npm install doesn't require the consumer to intervene.

Acceptance criteria

  • rm -rf node_modules package-lock.json && npm install succeeds with no --force/--legacy-peer-deps flag and no consumer-added overrides, on a project whose only relevant devDependency is "vite-plus": "^0.2.9" (or whatever the fixed version is).

Activity

  1. self-assigned this
    on Aug 23, 2026
  2. fengmk2 commented on Aug 23, 2026

    @fengmk2
    Member

    I can't reproduce this issue according to your reproduction description. Could you provide me with a minimal reproduce repo?

  3. github-actions commented on Aug 23, 2026

    @github-actions
    Contributor

    Hello @smiggleworth 👋

    Please provide a minimal reproduction using a GitHub repository. This helps us understand and resolve your issue much faster.

    A good reproduction should be:

    • Minimal – include only the code necessary to demonstrate the issue
    • Complete – contain everything needed to run and observe the problem
    • Reproducible – consistently show the issue with clear steps

    If no reproduction is provided, issues labeled needs reproduction will be closed after 3 days of inactivity.

    For more context on why this is required, please read: https://antfu.me/posts/why-reproductions-are-required

  4. peppe1337 commented on Aug 26, 2026

    @peppe1337

    I could not reproduce the bare-install failure. Measured on npm 12.0.2 (the version named in the report) and Node v22.22.3 on Linux, each cell a fresh empty directory with its own npm cache:

    devDependencies result
    "vite-plus": "^0.2.9" exit 0 — [email protected]; @vitest/browser-playwright not installed at all
    same, plus "@vitest/browser-playwright": "*" exit 0 — @vitest/[email protected] installed
    same, plus "@vitest/browser-playwright": "4.1.11" ERESOLVE

    [email protected] lists @vitest/browser-playwright in peerDependenciesMeta as optional: true, so a bare npm install does not pull it into the tree and there is nothing to conflict with.

    The report states that 4.1.11 is "the version npm's resolver reaches for when nothing else in the tree pins it". In the second row nothing in the root pins it, but [email protected] declares @vitest/browser-playwright@"4.1.10" as a peer, and npm 12.0.2 installs 4.1.10 rather than latest. The ERESOLVE appears in the third row, where the explicit 4.1.11 pin forces [email protected] into the tree against [email protected]'s own [email protected].

    I also noticed that the error output in the report contains oxfmt@"=0.61.0" from [email protected]. The registry shows =0.61.0 is the oxfmt pin of [email protected], while 0.2.9 uses =0.62.0, which suggests the tree that produced the error had 0.2.8 in it.

    Not covered by this: Node 26.5.0 (I ran Node 22.22.3), any .npmrc settings including legacy-peer-deps, the other root dependencies visible in the error output (oxfmt, oxlint, @askrjs/vite), a private registry mirror, and Windows.

  5. added a commit that references this issue on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions