Skip to content

Yarn cannot install a compatible set of dependencies due to engine bug #9198

@homersimpsons

Description

@homersimpsons

Reproduction

> docker run --detach --name node_18 node:18 sleep 1000
> docker exec -it node_18 bash
# cd /home/node/
# yarn init
# yarn add --dev vite@6
[...success...]
# yarn add --dev vitest
yarn add v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
error vite@7.0.3: The engine "node" is incompatible with this module. Expected version "^20.19.0 || >=22.12.0". Got "18.20.8"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

yarn should not attempt to upgrade to vite@7 here.

I also tried to:

  • yarn add --dev vite@6 vitest but this also fails
  • add "vitest": "^3.2.4" in my package.json and then yarn install but this also fails
  • use vite@~6.3.5 or even vite@6.3.5 but this also fails

Yarn v2 is not even checking engine: yarnpkg/berry#1177

The documentation also does not seem to provide any information https://classic.yarnpkg.com/lang/en/docs/cli/add/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions