Skip to content

Local package peer dependencies cause install errors after prune #10985

@mderrick

Description

@mderrick

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/mderrick/npm-workspace-deps

Which canary version will you have in your reproduction?

turbo@2.5.9-canary.8

Environment information

turbo 2.5.9-canary.8

CLI:
   Version: 2.5.9-canary.8
   Path to executable: <REDACTED>/npm-workspace-deps/node_modules/turbo-darwin-arm64/bin/turbo
   Daemon status: Not running
   Package manager: npm

Platform:
   Architecture: aarch64
   Operating system: macos
   WSL: false
   Available memory (MB): 14762
   Available CPU cores: 12

Environment:
   CI: None
   Terminal (TERM): xterm-256color
   Terminal program (TERM_PROGRAM): iTerm.app
   Terminal program version (TERM_PROGRAM_VERSION): 3.5.4
   Shell (SHELL): /opt/homebrew/bin/fish
   stdin: false

Expected behavior

I expect npm ci in the turbo prune output directory to work

Actual behavior

npm ci fails with:

npm error Missing: next@15.5.5 from lock file

To Reproduce

Create an NPM workspace that has two apps that depend on different versions of a package (Next 14 and 15 in this case) and then have one local package that both apps depend on with peerDependencies that satisfy both. Turbo prune creates an invalid lockfile:

// apps/app-one
{
  "name": "app-one",
  "dependencies": {
    "@repo/components": "*",
    "next": "^14.0.0"
  }
}
// apps/app-two
{
  "name": "app-two",
  "dependencies": {
    "@repo/components": "*",
    "next": "^15.0.0"
  }
}
// packages/components
{
  "name": "@repo/components",
  "peerDependencies": {
    "next": "^14 || ^15"
  },
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: pruneIssues and improvements relateed to Turborepo's `turbo prune` feature for lockfile pruningkind: bugSomething isn't working

    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