Guide · Open source
How to use Lerna: set up a monorepo and publish packages
Updated · written with AI from the project's own documentation and checked against our catalogue data
Lerna is an open-source command-line tool for JavaScript and TypeScript projects that keep several packages in one repository, a layout called a monorepo. It is meant to help you build those packages and publish them to npm. This guide explains what Lerna is for, what you need before installing it, how to get the source, and what to check before you adopt it.
Quick start
- 1Confirm you need a monorepo. Check that your project has several related JavaScript or TypeScript packages in one repository. Single-package projects gain little from Lerna.
- 2Install Node.js and npm. Make sure Node.js and npm are installed on your machine, since they are the listed prerequisites.
- 3Review the stewardship note. Read the linked Nx announcement and blog post in the README to understand the project's current direction.
- 4Clone the repository. Run git clone https://github.com/lerna/lerna to get the source code from GitHub.
- 5Read the Getting Started guide. Open https://lerna.js.org/docs/getting-started to learn the setup and commands for managing your packages.
- 6Compare alternatives. Weigh Lerna against Nx, Turborepo, pnpm workspaces and Yarn workspaces before committing to one.
What Lerna is for
Lerna describes itself as a fast, modern build system for managing and publishing multiple JavaScript and TypeScript packages from the same repository. It is aimed at teams that maintain several related npm packages together rather than one standalone project.
If your project has only a single package, the source does not suggest Lerna will add much value, because the tool is built around managing multiple packages.
- Good fit: several related npm packages in one repository
- Good fit: maintainers who version and publish packages together
- Poor fit: single-package projects
- Poor fit: non-JavaScript build needs
Check the project's stewardship before you start
The README contains an important note: the project changed stewardship to Nx. It links to a GitHub issue about the change and to an Nx blog post that says the tool is still alive. Read those linked announcements before you commit to Lerna, especially if you need a guaranteed direction for the project.
The README also points readers to Nx resources, including the Lerna documentation site, the Getting Started page and the Features page, for ongoing guidance.
- Read the linked Nx announcement before adopting Lerna
- Use the documentation at lerna.js.org for guides and tutorials
Prerequisites: Node.js and npm
The source lists Node.js and npm as the prerequisites. Install both before working with Lerna. The project is released under the MIT licence and is written in TypeScript.
- Node.js
- npm
Get the Lerna source
The README's install instruction is to clone the repository from GitHub. This gets you the source code of the project. The README does not spell out further installation steps in the text provided, so follow the Getting Started page on lerna.js.org for the full setup and usage workflow.
git clone https://github.com/lerna/lernaExplore the documentation and features
Once you have the project, the README links to a Getting Started guide and a Features page on the official documentation site. These are the best places to learn how to configure a monorepo and run Lerna commands, since the README itself is brief.
The README also links to community resources, including a Discord server, a Twitter account and a contributing guide for anyone who wants to file a bug or submit a pull request.
- Getting Started: https://lerna.js.org/docs/getting-started
- Features: https://lerna.js.org/docs/features
- Contributing guidelines are in CONTRIBUTING.md in the repository
Compare Lerna with other monorepo tools
Lerna is one of several tools for JavaScript monorepos. The comparable projects commonly considered are Nx, Turborepo, pnpm workspaces and Yarn workspaces. Each has a different scope, so compare them against your own build and publishing needs before choosing.
- Nx
- Turborepo
- pnpm workspaces
- Yarn workspaces
What people use it for
- Maintaining a set of related npm packages that share one repository
- Versioning and publishing several TypeScript packages together to npm
- Organising a JavaScript monorepo layout with dedicated tooling
Frequently asked questions
Is Lerna free to use?
Yes. The project is released under the MIT licence, as shown in the README. Check the LICENSE file in the repository for the full terms.
What do I need to install Lerna?
The source lists Node.js and npm as the prerequisites. The README's install step is to clone the repository from GitHub, and the Getting Started guide covers the rest of the setup.
Is Lerna still maintained?
The README says the project changed stewardship to Nx and links to an Nx announcement stating the tool is still alive and well. Read that linked material to judge the project's direction for your needs.
Can I use Lerna for a single package?
The source indicates Lerna is built for managing multiple packages, so it offers little benefit for a single-package project without a monorepo layout.
Does Lerna work with languages other than JavaScript?
No. The README describes Lerna for managing JavaScript and TypeScript packages only, so it is not a general build tool for other languages.
What are alternatives to Lerna?
Comparable projects include Nx, Turborepo, pnpm workspaces and Yarn workspaces. The right choice depends on whether you need build orchestration, publishing or workspace management.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Lerna suits JavaScript or TypeScript teams that maintain several related npm packages in one repository and want to version and publish them together. Because the README says stewardship moved to Nx, check the linked announcement before adopting it for long-term work, and consider Nx, Turborepo, pnpm workspaces or Yarn workspaces if you need a clearer direction. Single-package projects and non-JavaScript builds should pick a different tool.
Install options & downloads