question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow build times when running `lerna run build` from root of lerna project

See original GitHub issue

I opened an issue in another library(TSDX) I’m using to handle Typescript configuration in a small React + Typescript component library set up as a monorepo (using lerna). Build times always took a couple minutes but after upgrading TS versions they take noticeably longer. This all sounds like issues related to the bundler, but when I run npm run build from within each package build times aren’t long at all (a few seconds for one, and less than a minute for the other). Then when I go run lerna run build from the root of my package the build times are 6x slower.

tl;dr: My issue is painfully slow build times from running the build command in each package via lerna run build which is odd since running npm run build from each package doesn’t result in long build times.

Is there a configuration I’m not aware of that should be initialized inside of lerna.json? I’m not using yarn workspaces. I use npm. I’ve seen a few threads mention things about workspaces. Is there a npm counterpart for workspaces that might resolve this issue? Not sure how I would even debug this issue.

Your Environment

Lerna monorepo using TSDX to configure each React-based Typescript package.

Executable Version
lerna --version 3.16.4
npm --version 6.12.0
node --version v12.13.0
OS Version
macOS Sierra 10.13.5

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

5reactions
grimnomadcommented, Sep 1, 2020

My colleague found the problem. We are behind a corporate proxy. Every new process tries to run update-notifier which does not support proxies. Lerna is waiting until update-notifier finished before it runs the next command. You can create an entry in your .nmprc file with update-notifier=false. At least this is what has helped us.

3reactions
DavidWellscommented, Jan 31, 2021

I’m seeing this as well. Very slow builds from root dir using lerna. This wasn’t the case until recently…

Is there some cache file or something somewhere that might need to be purged?

Setting update-notifier=false had no effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Lerna just got 10x faster! - Nx Blog
TL;DR: We released a new beta version of Lerna and it happens that it is now 5.3 times faster than Turbo …by turning...
Read more >
The lerna build is very slow, always (+30 minutes)
Any ideas of what could have been set wrong in my project ? Or maybe this is just normal... performance · vue.js ·...
Read more >
How we reduced our nodejs monorepo build time by 70%
We migrated from yarn workspaces & lerna to PNPM and nx.dev ... to the project's root and running pnpm install , that's all....
Read more >
Getting Started | Lerna
If you are wondering whether it is slow to run lerna run dev --scope=remixapp given that you have to rebuild all the dependencies...
Read more >
Setting up a monorepo with Lerna for a TypeScript project
npm install -g lerna. We'll build a simple project. Ours will consist of multiple packages for our project, which we'll call hospital-sdk ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found