Skip to content

[BUG] linked strategy: non-idempotent install with workspace projects #9091

@manzoorwanijk

Description

@manzoorwanijk

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Running npm install --install-strategy=linked repeatedly on a workspace project always reports changed N packages even when nothing has actually changed. The dry-run output shows it "changing" packages to the exact same version (e.g. change abbrev 2.0.0 => 2.0.0), and reports duplicate entries for some packages.

This does not happen for non-workspace projects, which correctly report up to date.

Expected Behavior

Repeated installs with no changes should report up to date, audited N packages as it does for non-workspace projects and for other install strategies.

Steps To Reproduce

  1. Create a workspace project with cross-workspace dependencies:
mkdir -p test-diamond/packages/{workspace-x,workspace-y}

cat > test-diamond/package.json << 'EOF'
{
  "name": "test-diamond",
  "version": "1.0.0",
  "workspaces": ["packages/*"],
  "dependencies": { "workspace-x": "*", "workspace-y": "*" }
}
EOF

cat > test-diamond/packages/workspace-x/package.json << 'EOF'
{
  "name": "workspace-x",
  "version": "1.0.0",
  "dependencies": { "abbrev": "^2.0.0", "workspace-y": "*" }
}
EOF

cat > test-diamond/packages/workspace-y/package.json << 'EOF'
{
  "name": "workspace-y",
  "version": "1.0.0",
  "dependencies": { "abbrev": "^2.0.0" }
}
EOF
  1. Install and then install again:
cd test-diamond
npm install --install-strategy=linked
npm install --install-strategy=linked
  1. Second install reports changed 5 packages instead of up to date.

  2. Dry-run confirms the false diff:

npm install --install-strategy=linked --dry-run

Output:

change abbrev 2.0.0 => 2.0.0
change workspace-y 1.0.0 => 1.0.0
change abbrev 2.0.0 => 2.0.0
change workspace-y 1.0.0 => 1.0.0
change workspace-x 1.0.0 => 1.0.0

changed 5 packages

Environment

  • npm: 11.11.0
  • Node.js: v22.20.0
  • OS Name: macOS (Darwin 25.3.0)
  • System Model Name: Mac
  • npm config:
install-strategy=linked

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