Skip to content

Unable to install vitest 4.1.0 with vite ^7.0.0 using yarn 1.x #9859

@psmyrek

Description

@psmyrek

Describe the bug

Since the vitest release v4.1.0 it is not possible to install dependencies that include also vite using yarn classic (v1.x).

It seems that "vite": "^6.0.0 || ^7.0.0 || ^8.0.0-0" syntax is not supported by yarn v1.x, introduced in 990281dfd.

Reproduction

Create the following package.json file:

{
  "name": "foo",
  "version": "1.0.0",
  "dependencies": {
    "vite": "^7.0.0",
    "vitest": "^4.0.0"
  }
}

Then, try to install dependencies using yarn v1.x:

yarn install

Error:

$ yarn install

yarn install v1.22.22
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] Resolving packages...
⠁ (node:13352) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2/4] Fetching packages...
[3/4] Linking dependencies...
error Invariant Violation: could not find a copy of vite to link in D:\tmp2\node_modules\vitest\node_modules
    at invariant (C:\Users\psmyrek\AppData\Local\node\corepack\v1\yarn\1.22.22\lib\cli.js:2318:15)
    at PackageLinker.<anonymous> (C:\Users\psmyrek\AppData\Local\node\corepack\v1\yarn\1.22.22\lib\cli.js:48524:7)
    at Generator.next (<anonymous>)
    at step (C:\Users\psmyrek\AppData\Local\node\corepack\v1\yarn\1.22.22\lib\cli.js:310:30)
    at C:\Users\psmyrek\AppData\Local\node\corepack\v1\yarn\1.22.22\lib\cli.js:321:13
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (14) x64 Intel(R) Core(TM) Ultra 7 165U
    Memory: 12.02 GB / 31.46 GB
  Binaries:
    Node: 24.12.0 - C:\Users\psmyrek\AppData\Local\fnm_multishells\10624_1773409205157\node.EXE
    Yarn: 1.22.22 - C:\Users\psmyrek\AppData\Local\fnm_multishells\10624_1773409205157\yarn.CMD
    npm: 11.6.2 - C:\Users\psmyrek\AppData\Local\fnm_multishells\10624_1773409205157\npm.CMD
    pnpm: 10.32.1 - C:\Users\psmyrek\AppData\Local\fnm_multishells\10624_1773409205157\pnpm.CMD
  Browsers:
    Chrome: 145.0.7632.160
    Edge: Chromium (140.0.3485.54)
    Firefox: 148.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.26100.7309
  npmPackages:
    vite: ^7.0.0 => 7.3.1
    vitest: ^4.0.0 => 4.1.0

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions