Skip to content

fix: syncpack hangs indefinitely with cyclic PNPM workspace dependencies #321

@kopach

Description

@kopach

Syncpack version

14.0.0

Operating system(s)

Mac

Steps to reproduce

  1. Create a PNPM workspace with multiple packages.
  2. Introduce cyclic dependencies between workspace packages.

Example structure:

packages/
package-a → depends on package-b
package-b → depends on package-c
package-c → depends on package-a

  1. Install dependencies:
pnpm install
Terminal output

Terminal output:

❯ pnpm install
Scope: all XX workspace projects
WARN There are cyclic workspace dependencies:
/packages/package-a
/packages/package-b
/packages/package-c

PNPM reports cyclic workspace dependencies.

  1. Run syncpack:
pnpm syncpack fix

The process freezes indefinitely.

Expected behavior

syncpack should detect cyclic workspace dependencies and either:

  • exit with an error, or
  • show a warning and terminate gracefully.

The command should not hang indefinitely.

Actual behavior

syncpack fix never completes when cyclic dependencies exist.

The process appears frozen and must be manually terminated using Ctrl+C.

Removing the cyclic dependency allows syncpack to run normally.

Contents of syncpack configuration file

{
  "versionGroups": [
    {
      "label": "Use workspace protocol when developing local packages",
      "dependencies": ["$LOCAL"],
      "dependencyTypes": ["!local"],
      "pinVersion": "workspace:*"
    },
    {
      "label": "Allow pnpm override references (e.g., $react)",
      "dependencyTypes": ["pnpmOverrides"],
      "dependencies": ["**"],
      "isIgnored": true
    }
  ],
  "semverGroups": [
    {
      "label": "Use exact versions for all dependencies",
      "dependencies": ["**"],
      "range": ""
    }
  ]
}

Optional comments

The issue is especially problematic when syncpack is attached to git hook. Then it's even more difficult to detect what is the problem

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions