Using pnpm with Lerna
Lerna can be used in a pnpm workspace to get the full benefits of both pnpm and Lerna.
When used in a pnpm workspace, Lerna will:
- resolve package locations with pnpm-workspace.yaml(https://pnpm.io/workspaces)
- ignore "workspaces"inpackage.json
- block usage of bootstrap,link, andaddcommands. Instead, you should usepnpmcommands directly to manage dependencies (https://pnpm.io/cli/install).
- respect the workspace protocol for package dependencies.
- During lerna version, dependencies will be updated as normal, but will preserve theworkspace:prefix if it exists.
- If a workspace alias is used, then lerna versionwill not bump the version of the dependency, since aliases don't specify a version number to bump.
 
- During 
Getting Started
To set up pnpm with Lerna:
- 
If not installed already, install pnpm: https://pnpm.io/installation.
- 
Remove the node_modules/folder in the root, if it exists. If not already using workspaces, runlerna cleanto remove thenode_modules/folder in all packages.
- 
Set "npmClient": "pnpm"inlerna.json.
- 
Create a pnpm-workspace.yamlfile in the root of your project. If you are already using npm or yarn workspaces, move the "workspaces" property frompackage.jsontopnpm-workspace.yaml. If you were not already using workspaces, move the "packages" property fromlerna.jsontopnpm-workspace.yaml. For example:package.json{
 "workspaces": ["packages/*"]
 }and lerna.json{
 "packages": ["packages/*"]
 }become: pnpm-workspace.yamlpackages:
 - "packages/*"
- 
(optional) Run pnpm importto generate apnpm-lock.yamlfile from an existing lockfile. See https://pnpm.io/cli/import for supported lockfile sources.
- 
Run pnpm install.