Lerna is a fast, modern build system and monorepo management tool for JavaScript and TypeScript projects. It allows developers to manage and publish multiple packages from a single repository, streamlining development workflows for complex applications and libraries. The current stable version is 9.0.7, with frequent patch releases addressing bug fixes and minor improvements, and major versions typically released every 1.5 to 2 years. Key differentiators include its integration with Nx for advanced caching and optimized task execution, efficient package publishing (supporting both fixed and independent versioning), and a focus on performance by avoiding redundant builds. Lerna helps teams maintain a unified development experience across many packages while leveraging the benefits of a monorepo structure, such as shared code and simplified CI processes.
npm install lernaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a Lerna monorepo, create packages, and execute scripts across them using the Lerna CLI. It covers initialization, package creation, running a shared build script, and preparing for package publishing.
Upgrade Node.js to a supported version (20.x, 22.x, or 24.x+). It is recommended to run `npx lerna repair` after upgrading Lerna to ensure `lerna.json` is up to date.
Migrate to using your package manager's native workspaces feature (npm, Yarn, pnpm) for package management concerns like installing and linking dependencies. Consult the Lerna documentation on 'Legacy Package Management' for migration guides.
This removal is tied to the deprecation of `bootstrap`, `add`, and `link` commands. Migrate to using native package manager workspaces as the primary method for managing package dependencies.
Ensure your `lerna.json` is at the root of your project or configure `searchStrategy: 'global'` if using advanced `cosmiconfig` setups. Running `lerna repair` may help.
Ensure your `package.json` files correctly define peer dependencies and their versions. If specific legacy behavior is required, consult Lerna or package manager documentation for explicit configuration options, though this is generally not recommended.
Use the format `npx lerna run --scope="package-*" test` instead of `npx lerna run --scope=package-* test`.
While Lerna is actively working on updating these dependencies, the warnings are typically informational and don't block functionality. Future Lerna versions are expected to address these. In the meantime, ensure your project's overall dependencies are regularly audited.
Install Lerna locally (`npm install --save-dev lerna`) and run commands with `npx lerna <command>`, or install globally (`npm install -g lerna`) and run `lerna <command>`.
Verify the `workspaces` array in your root `package.json` or `lerna.json` matches your project structure (e.g., `"packages/*"`). Ensure that packages actually contain the specified npm script in their `package.json`. Check for `.gitignore` files that might be excluding package directories. Run `npx lerna list` to confirm Lerna detects your packages.
Ensure all internal packages are built before being consumed. Verify `tsconfig.json` in consuming packages include correct `paths` mapping. Make sure internal packages' `package.json` specify `main`, `types` (for declaration files), and potentially `exports` fields. Set `compilerOptions.declaration: true` in `tsconfig.json` for packages that are consumed by others.
For older Lerna versions (pre-v9), add packages individually: `lerna add <dependency> --scope=<target-package>`. For Lerna v9+, use your package manager's native commands (e.g., `npm install <dependency> -w <target-package>`) as `lerna add` has been removed.
Upgrade Lerna to a version greater than `6.5.0` (e.g., `npm install lerna@latest`). This issue was resolved in subsequent patch releases of Lerna v6.
No dependency data recorded yet.