{"id":12113,"library":"syncpack","title":"Syncpack","description":"Syncpack is a robust CLI tool and library designed to enforce consistent dependency versions across large JavaScript and TypeScript monorepos. Currently at stable version 14.3.0, it maintains a regular and active release cadence with several updates, including patches and minor features, issued monthly. Its core functionality includes linting for version inconsistencies, automatically fixing them, and updating dependencies to the latest available versions while preserving semver ranges. Syncpack differentiates itself through its deep integration with various monorepo tools like Lerna, Nx, and pnpm, and its recent rewrite in Rust for version 14 significantly improved performance and introduced a new, more modular API. It is widely adopted by organizations such as AWS, Microsoft, and Vercel for maintaining their large-scale projects.","status":"active","version":"14.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/JamieMason/syncpack","tags":["javascript","dependencies","exact-versions","lerna","lernajs","monorepo","npm","nx","package-json","typescript"],"install":[{"cmd":"npm install syncpack","lang":"bash","label":"npm"},{"cmd":"yarn add syncpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add syncpack","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Since v14, programmatic functions like 'lint' are exposed via the 'syncpack/cli' entry point. CommonJS 'require' is not supported for these ESM exports.","wrong":"const lint = require('syncpack/cli')","symbol":"lint","correct":"import { lint } from 'syncpack/cli'"},{"note":"Named exports from 'syncpack/cli' are the correct way to access CLI command functions programmatically in v14+. Avoid default imports from the root package.","wrong":"import fix from 'syncpack'","symbol":"fix","correct":"import { fix } from 'syncpack/cli'"},{"note":"The 'update' command's programmatic interface is also available as a named export from 'syncpack/cli'. Ensure you pass appropriate options objects.","symbol":"update","correct":"import { update } from 'syncpack/cli'"}],"quickstart":{"code":"npx cross-env MY_MONOREPO_ROOT=\"$(pwd)\" bash -c '\n  # 1. Initialize a new monorepo project\n  mkdir my-syncpack-demo && cd my-syncpack-demo\n  npm init -y &>/dev/null\n  mkdir -p packages/app-a packages/app-b\n  echo \"{ \\\"name\\\": \\\"app-a\\\", \\\"version\\\": \\\"1.0.0\\\", \\\"dependencies\\\": { \\\"react\\\": \\\"18.2.0\\\", \\\"lodash\\\": \\\"^4.17.21\\\" } }\" > packages/app-a/package.json\n  echo \"{ \\\"name\\\": \\\"app-b\\\", \\\"version\\\": \\\"1.0.0\\\", \\\"dependencies\\\": { \\\"react\\\": \\\"^18.0.0\\\", \\\"lodash\\\": \\\"4.17.15\\\" } }\" > packages/app-b/package.json\n  echo \"{ \\\"name\\\": \\\"my-monorepo-root\\\", \\\"private\\\": true, \\\"workspaces\\\": [\\\"packages/*\\\"] }\" > package.json\n\n  echo \"\\n--- Created initial monorepo structure with inconsistent lodash versions ---\"\n  cat packages/app-a/package.json\n  cat packages/app-b/package.json\n\n  # 2. Install syncpack as a dev dependency in the root\n  npm install --save-dev syncpack &>/dev/null\n  echo \"\\n--- syncpack installed ---\"\n\n  # 3. Check for dependency inconsistencies\n  echo \"\\n--- Running syncpack lint ---\"\n  npx syncpack lint || true # lint exits with non-zero on issues\n\n  # 4. Fix inconsistencies across the monorepo\n  echo \"\\n--- Running syncpack fix ---\"\n  npx syncpack fix\n\n  # 5. Review the changes\n  echo \"\\n--- package.json files after syncpack fix ---\"\n  cat packages/app-a/package.json\n  cat packages/app-b/package.json\n\n  # 6. (Optional) Update all dependencies to their latest compatible versions\n  echo \"\\n--- Running syncpack update --target latest ---\"\n  npx syncpack update --target latest --dependency-types prod,dev\n\n  cd $MY_MONOREPO_ROOT && rm -rf my-syncpack-demo\n'\n","lang":"bash","description":"This quickstart demonstrates setting up a minimal monorepo, installing Syncpack, identifying inconsistent dependency versions with `lint`, automatically fixing them with `fix`, and then updating all dependencies to their latest compatible versions using `update`."},"warnings":[{"fix":"Consult the official 'Migrate to 14' guide on syncpack.dev. Update CLI commands and programmatic imports to the new 'syncpack/cli' entry points.","message":"Syncpack v14 is a complete rewrite in Rust, introducing a new API and CLI command structure. Older configurations and programmatic integrations will likely break.","severity":"breaking","affected_versions":">=14.0.0"},{"fix":"Upgrade Syncpack to version 14.0.2 or newer to resolve pnpm-related issues.","message":"Pnpm users on Syncpack versions 14.0.0 and 14.0.1 experienced bugs due to issues with negated source globs and dependency handling.","severity":"gotcha","affected_versions":"14.0.0, 14.0.1"},{"fix":"Review your `syncpack.config.js` or `.syncpackrc` files against the latest documentation for v14 to ensure compatibility with new parsing and option structures.","message":"The `syncpack.config.js` now allows `//` comments, but older config file formats or specific options might have changed behavior or been deprecated.","severity":"breaking","affected_versions":">=14.0.0"},{"fix":"When using `import { lint, fix } from 'syncpack/cli'`, ensure you handle the `isOk()` and `isErr()` methods on the returned object to properly manage outcomes and potential errors.","message":"Programmatic usage of Syncpack commands now returns a `Result` type (either success or error) instead of direct exceptions or boolean results.","severity":"gotcha","affected_versions":">=14.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Refer to the Syncpack v14 documentation for the updated CLI commands and options. Many commands were renamed or restructured.","cause":"Attempting to use pre-v14 CLI commands or options after upgrading to Syncpack v14, which introduced a new command-line interface and API.","error":"Error: Command 'x' not found or 'y' is not a valid option"},{"fix":"Upgrade your Syncpack dependency to version 14.0.2 or higher to resolve known pnpm compatibility issues.","cause":"Running Syncpack versions 14.0.0 or 14.0.1 with pnpm due to a bug in handling glob patterns or package resolution.","error":"Error: Syncpack encountered an issue related to pnpm workspaces (specific error message might vary)"},{"fix":"Ensure you are using `import { lint } from 'syncpack/cli'` (or other command names) for programmatic access, and that your project is configured for ESM if using Node.js.","cause":"Incorrect programmatic import path or CommonJS `require()` syntax being used for Syncpack's ESM-only exports in v14+.","error":"TypeError: (0 , syncpack_1.lint) is not a function or Module not found: Error: Can't resolve 'syncpack'"}],"ecosystem":"npm"}