Skip to content

Root and child workspaces pin different packageManager Yarn versions (root 4.9.1, children 4.0.2) #894

Description

@iamtanuj18

Background

Root package.json pins packageManager: yarn@4.9.1, but three child workspaces pin an older version:

Workspace packageManager
root yarn@4.9.1
application/backend yarn@4.0.2
application/common yarn@4.0.2
application/integrations yarn@4.0.2

(application/user-client and application/admin-client don't declare packageManager.)

Running make seed from a fresh clone triggers a Corepack prompt to download the older 4.0.2:

yarn prisma:migrate
! Corepack is about to download https://repo.yarnpkg.com/4.0.2/packages/yarnpkg-cli/bin/yarn.js
? Do you want to continue? [Y/n]

This happens because make seed runs yarn prisma:migrate, which enters the backend workspace's context. Corepack sees the backend's own packageManager declaration and downloads that specific version, even though yarn install at root already used 4.9.1.

Not sure if the divergence is intentional (some behaviour depended on 4.0.2 specifically) or leftover from an incomplete upgrade after the root was bumped to 4.9.1.

Problem

Functionally, nothing breaks. Both Yarn versions run scripts correctly. Two smaller issues:

  • Mid-setup Corepack prompt. New contributors get a "download this other Yarn version" prompt right after yarn install at root already downloaded 4.9.1. Reads as accidental.
  • Two Yarn versions cached per developer. Each machine ends up with both 4.9.1 and 4.0.2 in Corepack's cache.

In a Yarn workspaces monorepo, child workspaces usually shouldn't declare packageManager at all. One declaration at root governs the whole tree cleanly, and per-workspace fields are redundant and drift-prone.

Proposed approach

Two options, either works:

  • Remove the packageManager field entirely from application/backend, application/common, and application/integrations. Root's declaration then governs all workspaces.
  • Alternatively, align all four (root plus the three children) on the same Yarn version.

Removing the field from children is arguably cleaner because it removes the possibility of future drift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions