Questions tagged [lerna]

Lerna is a tool designed to help develop JavaScript projects in a single git repo containing multiple related npm packages.

The two primary commands in Lerna are lerna bootstrap and lerna publish.

bootstrap will link dependencies in the repo together. publish will help publish any updated packages.

Related links:

644 questions
55
votes
1 answer

the difference between nx and Lerna ? (monorepos)

hello i'm in new in monorepos world and i'm now searching about different monorepos tools and i found two intersting tools Nx(nrwl) and lerna but i didn't understand the real differnce between these two tools so any help and thanks
anis khalfaoui
  • 779
  • 1
  • 6
  • 12
48
votes
3 answers

Is Lerna needed anymore with NPM workspaces?

Is Lerna needed anymore with NPM 7.0.0 workspaces? I don't really have experience with this new npm feature. npm/RFCs writes: First and foremost there’s the alternative of leaving the problem set for userland to solve, there’s already the very…
Markus Guder
  • 621
  • 1
  • 5
  • 11
39
votes
4 answers

Allow local project to depend on local lerna packages

I have a lerna repo for a project under development. It has several packages that depend on each other. To make development easier, none of the packages are published and they depend on the latest version of each other. Directory tree foo/ …
Jack Guy
  • 8,346
  • 8
  • 55
  • 86
34
votes
3 answers

How to build docker images in a lerna monorepo without publishing

The use case for this is branch building and deployments in Lerna monorepos. The problem is that Lerna monorepos either hoist dependencies in NPM or use yarn workspaces to the same effect to collect all dependencies in the node_modules folder of the…
Gudlaugur Egilsson
  • 2,420
  • 2
  • 24
  • 23
34
votes
9 answers

Unable to run lerna's command

I am trying to install lerna using npm , packages are successfully added but when I run any command of lerna it comes out as. bash: lerna: command not found Node Version : v8.10.0 Npm Version : 3.10.9. Here's what I am trying: $ npm install…
Vaibhav Agrawal
  • 714
  • 2
  • 6
  • 10
28
votes
2 answers

Is there a way to "refresh" an imported repository with Lerna?

I am involved in a project with two separate repositories that we will soon be combining into a monorepo. Lerna's import command will be very helpful in this regard, so we will keep the projects' histories. However, there are currently some…
Joe Attardi
  • 4,381
  • 3
  • 39
  • 41
27
votes
1 answer

Peer Dependencies In A Monorepo

When packages in a monorepo have peer dependencies, how should these dependencies be made available to them during development? For example a package at /packages/namespace/alpha/ might have a devDependency of styled-components in its package.json.…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
26
votes
1 answer

LernaJS Typescript cannot find module

I'm trying to use LernaJS with typescript and I have some problems. When I try to run my package-1 which has package-2 as dependency I get the error: module.js:549 throw err; ^ Error: Cannot find module 'package-2' …
J G
  • 363
  • 1
  • 3
  • 7
25
votes
4 answers

How To Set Up GitHub Actions to Publish a Lerna Monorepo

I maintain a lerna/yarn monorepo. I'm in the process of migrating the CI/CD from circle to the new GitHuba Actions publish beta. I've created the following workflow: name: CD on: push: branches: - master jobs: build: runs-on:…
Benny Powers
  • 5,398
  • 4
  • 32
  • 55
25
votes
5 answers

Using Lerna with unpublished packages

I'm trying to set up my monorepo with Lerna. The plan is to refactor an existing project by pulling chunks of code out which should be their own packages. I've run lerna init, and my current setup looks like this: project/ packages/ …
NiloCK
  • 571
  • 1
  • 11
  • 33
23
votes
2 answers

Install package from lerna-managed monorepo via git URL

I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna. The subpackage was updated but not published yet and I need that unpublished code. Is there any way to install…
Max Komarychev
  • 2,836
  • 1
  • 21
  • 32
22
votes
6 answers

Building Typescript: [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

I've encountered problem building typescript packages with rollup inside lerna managed monorepo. Error: lerna ERR! rollup --config ../../rollup.config.js stderr: loaded ../../rollup.config.js with warnings (!) Unused external imports terser imported…
Kirill Morozov
  • 493
  • 1
  • 3
  • 12
22
votes
0 answers

With Yarn workspaces, how can compiled binaries be linked to the workspace post-compilation?

Context Yarn workspaces provide for a convenient mono-repo-like functionality where packages are automatically linked. I.e. they can require/import each other, and their binaries are linked and accessible from the workspace root. An…
Tom
  • 8,536
  • 31
  • 133
  • 232
21
votes
3 answers

Remove dependency from nested Lerna Package

I have a lerna setup with n packages located under packages/. Let us take an example where one of the packages uses express where the others do not. How can I remove express from this package in a lerna-aware manner so the root package.json is…
Ray Booysen
  • 28,894
  • 13
  • 84
  • 111
20
votes
2 answers

How Should VSCode Be Configured To Support A Lerna Monorepo?

I have a lerna monorepo containing lots of packages. I'm trying to achieve the following: Ensure that VSCode provides the correct import suggestions (based on package names, not on relative paths) from one package to another. Ensure that I can…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
1
2 3
42 43