Skip to content

Unable to find locally installed turbo with yarn berry (nodeLinker: pnpm) #10832

@ZeekoZhu

Description

@ZeekoZhu

When using Yarn v4 with nodeLinker: pnpm, Turborepo is unable to find the locally installed turbo package and falls back to using the globally installed version, which can cause unexpected behavior.

Reproduction Steps

  1. Clone this repository https://github.com/ZeekoZhu/yarn-pnpm-turbo
  2. Run yarn install to install dependencies
  3. Run yarn turbo-version

Expected Behavior

The command should use the locally installed turbo version (^2.5.6) without any warnings.

Actual Behavior

WARNING  No locally installed `turbo` found in your repository. Using globally installed version (2.5.6), which can cause unexpected behavior.

Installing the version in your repository (^2.5.6) before calling `turbo` will result in more predictable behavior across environments.
2.5.6

Configuration

  • Yarn version: 4.9.4
  • Turbo version: ^2.5.6
  • nodeLinker: pnpm
  • Package manager: yarn@4.9.4

Files

  • package.json: Contains turbo dependency and script
  • .yarnrc.yml: Configured with nodeLinker: pnpm

Root Cause

The per-platform packages as linked in (realpath node_modules/turbo)/../node_modules, but the code here searches the wrong location for yarn (pnpm linker).

// - berry (nodeLinker: "pnpm")
fn generate_nested_path(root_path: &AbsoluteSystemPath) -> Option<AbsoluteSystemPathBuf> {
Some(root_path.join_components(&["node_modules", "turbo", "node_modules"]))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions