Currently viewing the human version
Switch to AI version

When Publishing Multiple Packages Becomes a Shitshow

You update a utility package, forget to bump the version in the three apps that depend on it, and suddenly everyone's CI is broken with Cannot resolve module '@company/utils@1.2.3'. You spend 2 hours figuring out which packages need version bumps and which order to publish them without breaking npm installs.

Lerna solves the specific pain of coordinating releases. It tracks which packages changed, bumps versions automatically, and publishes in dependency order so Package A doesn't go live before Package B when A depends on B. The React team uses it because managing dozens of packages manually is impossible.

The Publishing Pain Points That Will Bite You

Version Hell: Miss one dependency bump and you get angry GitHub issues about broken installs. I've seen teams publish something like @company/ui@2.1.0 that depends on @company/utils@1.3.0, but @company/utils is still sitting at 1.2.8 or whatever. Users install the new UI and get Module not found errors. Lerna tracks these relationships so it doesn't happen.

Publishing Order Will Fuck You: Publish Package A before Package B updates its dependency on A, and npm users get 30 seconds of broken installs. Enough time for your Slack to blow up with "build is broken" messages. Lerna calculates the dependency graph and publishes in order.

Git Tag Nightmare: Manual tagging means someone uses v1.2.3, someone else uses 1.2.3, and your changelog generation breaks. Lerna creates conventional commit-based tags consistently.

Lerna dependency graph and publishing workflow

The Nx Integration Reality Check (It's Complicated)

When Nrwl took over Lerna in 2022, they integrated Nx caching. Now your builds are fast when the cache works, but when it doesn't, you'll spend hours debugging why Package A rebuilt when nothing changed. Miss one environment variable in your cache inputs and you get stale builds that pass locally but fail in CI.

The caching hashes file contents and dependencies to store build outputs. Change one file, Nx rebuilds that package plus everything depending on it. The problem is figuring out what counts as an "input" - your source files, yes, but also .env files, global configs, and whatever random shit your build script reads. Get it wrong and cache keys become useless.

Lerna gets regular updates - version 8.2.4 is current as of 2025 with Node.js 22 support and bug fixes. The documentation is solid, and you can usually get help on Stack Overflow when things break.

Works with conventional commits if your team can be trusted to write commit messages correctly (good luck). Plays nice with GitHub Actions for CI/CD, though you'll spend time debugging why the auth token works locally but fails in CI. Most teams end up adding TypeScript project references, ESLint configs, and Prettier because apparently we love making simple things complicated.

Lerna vs Alternative Monorepo Tools

Feature

Lerna

Nx

Turborepo

Rush

pnpm Workspaces

Setup Complexity

Moderate

Pain in the ass

Actually simple

Pain in the ass

Just works

Task Caching

✅ (via Nx)

Distributed Execution

✅ ($$$)

Package Publishing

✅ (best)

❌ (prepare for pain)

✅ (ok)

Task Parallelization

Dependency Graph

Learning Curve

Medium

Steep as fuck

Actually reasonable

Steep

None

Documentation Quality

Good

Excellent (but dense)

Good

Sparse

Basic

Will Break Your Weekend

Sometimes

Probably

Rarely

Definitely

Never

Actually Using Lerna (What They Don't Tell You)

Setup usually takes a while - maybe 20 minutes if everything goes right, could be most of your afternoon if it doesn't. The Nx integration works great until it doesn't, then you're googling "nx cache miss" at 2am trying to figure out why your build takes 10 minutes again.

The Publishing Workflow That Works

Lerna's main strength is coordinating npm package releases. When you run lerna publish, it:

  1. Detects which packages have changes since the last release
  2. Figures out version bumps based on conventional commits (if you use them)
  3. Updates package.json files and inter-package dependencies
  4. Creates git tags and publishes to npm in dependency order

Monorepo build and task orchestration workflow

This actually works most of the time. When it doesn't, you get cryptic errors like npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@company%2futils and have to figure out whether it's auth, network, or package name issues. But it beats manually coordinating releases where someone always publishes the wrong version.

Two versioning modes:

  • Independent: Each package has its own version (good for libraries)
  • Fixed: All packages share one version (simpler for apps)

Most teams I've worked with prefer independent versioning because different packages evolve at different rates.

Caching Reality Check

Since Lerna 6, builds go through Nx's caching system. This is genuinely useful for large monorepos but adds complexity:

When caching helps:

  • Your builds are slow (>30 seconds)
  • You have >10 packages with complex build steps
  • Multiple developers work on the same monorepo

When caching becomes a nightmare:

  • Simple projects where caching overhead exceeds build time
  • Teams who spend more time debugging cache misses than building features
  • CI environments where random environment differences invalidate cache keys
  • Docker builds where filesystem timestamps fuck up cache inputs

The cache stores build outputs based on file hashes. Sounds simple until you realize your build reads .env.local, some random config file, and the phase of the moon. Miss one input and you get stale builds that work locally but fail in prod. Debugging requires understanding Nx internals, which defeats the "it just works" promise.

Setup Pain Points

Basic setup is npx lerna init, but you'll hit these gotchas:

{
  "version": "independent",
  "useNx": true,
  "npmClient": "npm"
}

useNx: true is the default, but the docs don't tell you when to turn the damn thing off. Hint: if you just want to publish packages without learning another build system, set it to false and save yourself hours of cache debugging.

Shit that will break:

  • Build task configuration requires understanding Nx project.json format
  • Error messages like Cannot find project 'my-package' when your workspace detection fails
  • Windows PATH length limits break deep node_modules (yes, still a thing in 2025)
  • The migration guide assumes your old config was simple

Migrating from Lerna 5 takes way longer than the docs claim. Plan on spending a weekend, maybe more, debugging configuration edge cases that the changelog doesn't mention.

Teams that make Lerna work have at least one person who gets both the publishing workflow and Nx's caching bullshit. If you just need to coordinate 3-4 package releases, pnpm workspaces is probably less painful.

When shit breaks, check the GitHub issues first. Someone else probably hit the same problem.

Frequently Asked Questions

Q

Why does `lerna publish` shit the bed with auth errors every damn time?

A

Your npm token expires and suddenly nothing works.

Run npm whoami to see if you're even logged in. For CI, your NPM_TOKEN probably got overwritten or the secret expired. Sometimes it's just npm being npm.Also check your `.npmrc` file

  • if you're using a private registry, Lerna publishes there by default and corporate proxies love to randomly break auth for no apparent reason.
Q

Should I bother with Lerna for just 3 packages?

A

Hell no. Lerna is overkill unless you have 10+ packages or complex dependency chains. For small projects, pnpm workspaces does shared dependencies without the complexity tax. Don't make your life harder than it needs to be.

Q

Why does this shit randomly rebuild everything when nothing changed?

A

Run lerna run build --verbose and prepare to hate your life. Common reasons your cache is fucked:

  • Environment variables like NODE_ENV changing between local and CI
  • Files with timestamps that change on every checkout (looking at you, git)
  • Missing cache inputs for files your build secretly reads

The Nx cache troubleshooting guide helps if you can stomach learning another tool's debugging process.

Q

Can I turn off the Nx integration if it's causing problems?

A

Yes, set "useNx": false in your lerna.json. You'll lose caching and some performance optimizations, but get back the simpler pre-version-6 behavior. This is useful for teams that just want basic task running without cache complexity.

Q

Why do I keep getting "cannot find module" errors for packages that obviously exist?

A

Lerna's dependency detection gets confused when you mix dependencies and devDependencies wrong. Make sure internal packages are in dependencies, not devDependencies, even if they feel like dev tools.

Also check your workspace configuration - if packages aren't detected, Lerna ignores them and your builds break in mysterious ways.

Q

Is there a way to publish only specific packages?

A

Yes, use lerna publish --scope=package-name or lerna publish from-package to publish packages that have been version-bumped but not yet published. This is handy when a previous publish partially failed.

The scoped publishing docs cover the different filtering options.

Q

When does Nx Cloud become expensive?

A

Nx Cloud pricing kicks in when you exceed their free tier limits. For most teams, the free tier covers development usage fine. You'll hit limits when running lots of CI builds across large monorepos, or if your builds are just fucking huge.

Check Nx Cloud pricing for current limits. Some teams find the cost worthwhile for distributed caching, others just deal with slower builds because who has budget for build tooling.

Q

How fucked am I if I need to migrate from Lerna 5?

A

The Nx integration changes everything. The migration guide covers the basics but misses edge cases that will bite you:

  • Task definitions require learning Nx project.json format
  • Cache configuration breaks in ways the docs don't mention
  • CLI flags changed and some scripts will fail silently

Budget a weekend minimum, maybe longer if you hit weird edge cases. Test on a branch first because rolling back sucks when your CI is broken and the team is breathing down your neck.

Related Tools & Recommendations

alternatives
Recommended

Your Monorepo Builds Take 20 Minutes Because Yarn Workspaces Is Broken

Tools that won't make you want to quit programming

Yarn Workspaces
/alternatives/yarn-workspaces/modern-monorepo-alternatives
100%
tool
Recommended

Yarn Workspaces - Monorepo Setup That Actually Works

Stop wrestling with multiple package.json files and start getting shit done.

Yarn Workspaces
/tool/yarn-workspaces/monorepo-setup-guide
100%
compare
Recommended

Pick Your Monorepo Poison: Nx vs Lerna vs Rush vs Bazel vs Turborepo

Which monorepo tool won't make you hate your life

Nx
/compare/nx/lerna/rush/bazel/turborepo/monorepo-tools-comparison
89%
troubleshoot
Recommended

npm Threw ERESOLVE Errors Again? Here's What Actually Works

Skip the theory bullshit - these fixes work when npm breaks at the worst possible time

npm
/troubleshoot/npm-install-error/dependency-conflicts-resolution
66%
news
Recommended

Major npm Supply Chain Attack Hits 18 Popular Packages

Vercel responds to cryptocurrency theft attack targeting developers

OpenAI GPT
/news/2025-09-08/vercel-npm-supply-chain-attack
66%
tool
Recommended

npm - The Package Manager Everyone Uses But Nobody Really Likes

It's slow, it breaks randomly, but it comes with Node.js so here we are

npm
/tool/npm/overview
66%
troubleshoot
Recommended

Fix Yarn Corepack "packageManager" Version Conflicts

Stop Yarn and Corepack from screwing each other over

Yarn Package Manager
/tool/troubleshoot/yarn-package-manager-error-troubleshooting/corepack-version-conflicts
66%
tool
Recommended

pnpm - Fixes npm's Biggest Annoyances

compatible with pnpm

pnpm
/tool/pnpm/overview
66%
alternatives
Recommended

Turborepo Alternatives - When You're Done With Vercel's Bullshit

Escaping Turborepo hell: Real alternatives that actually work

Turborepo
/alternatives/turborepo/decision-framework
45%
tool
Recommended

Turborepo - Make Your Monorepo Builds Not Suck

Finally, a build system that doesn't rebuild everything when you change one fucking line

Turborepo
/tool/turborepo/overview
45%
tool
Recommended

GitHub Actions Marketplace - Where CI/CD Actually Gets Easier

integrates with GitHub Actions Marketplace

GitHub Actions Marketplace
/tool/github-actions-marketplace/overview
41%
alternatives
Recommended

GitHub Actions Alternatives That Don't Suck

integrates with GitHub Actions

GitHub Actions
/alternatives/github-actions/use-case-driven-selection
41%
integration
Recommended

GitHub Actions + Docker + ECS: Stop SSH-ing Into Servers Like It's 2015

Deploy your app without losing your mind or your weekend

GitHub Actions
/integration/github-actions-docker-aws-ecs/ci-cd-pipeline-automation
41%
tool
Popular choice

jQuery - The Library That Won't Die

Explore jQuery's enduring legacy, its impact on web development, and the key changes in jQuery 4.0. Understand its relevance for new projects in 2025.

jQuery
/tool/jquery/overview
41%
tool
Popular choice

AWS RDS Blue/Green Deployments - Zero-Downtime Database Updates

Explore Amazon RDS Blue/Green Deployments for zero-downtime database updates. Learn how it works, deployment steps, and answers to common FAQs about switchover

AWS RDS Blue/Green Deployments
/tool/aws-rds-blue-green-deployments/overview
39%
tool
Popular choice

KrakenD Production Troubleshooting - Fix the 3AM Problems

When KrakenD breaks in production and you need solutions that actually work

Kraken.io
/tool/kraken/production-troubleshooting
35%
troubleshoot
Popular choice

Fix Kubernetes ImagePullBackOff Error - The Complete Battle-Tested Guide

From "Pod stuck in ImagePullBackOff" to "Problem solved in 90 seconds"

Kubernetes
/troubleshoot/kubernetes-imagepullbackoff/comprehensive-troubleshooting-guide
34%
troubleshoot
Popular choice

Fix Git Checkout Branch Switching Failures - Local Changes Overwritten

When Git checkout blocks your workflow because uncommitted changes are in the way - battle-tested solutions for urgent branch switching

Git
/troubleshoot/git-local-changes-overwritten/branch-switching-checkout-failures
32%
tool
Recommended

NGINX Ingress Controller - Traffic Routing That Doesn't Shit the Bed

NGINX running in Kubernetes pods, doing what NGINX does best - not dying under load

NGINX Ingress Controller
/tool/nginx-ingress-controller/overview
30%
tool
Recommended

Nx - Caches Your Builds So You Don't Rebuild the Same Shit Twice

Monorepo build tool that actually works when your codebase gets too big to manage

Nx
/tool/nx/overview
30%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization