Skip to main content

Questions tagged [lerna]

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

Filter by
Sorted by
Tagged with
61 votes
1 answer
30k views

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 ...
anis's user avatar
  • 875
51 votes
3 answers
23k views

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 ...
Markus Guder's user avatar
38 votes
4 answers
29k views

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 ...
Jack Guy's user avatar
  • 8,445
35 votes
9 answers
75k views

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 : ...
Vaibhav Agrawal's user avatar
34 votes
3 answers
17k views

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 ...
Gudlaugur Egilsson's user avatar
30 votes
2 answers
2k views

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' ...
Joe Attardi's user avatar
  • 4,501
29 votes
1 answer
15k views

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 ...
Undistraction's user avatar
28 votes
3 answers
6k views

How to get rollup to include a dependency from another package in a lerna monorepo in its transpilation (TypeScript)?

I created a minimal example to show the question I have: Github repo. I have a lerna monorepo with two npm packages in the packages folder, the packages are called: utils: exports a function: ...
xoux's user avatar
  • 3,444
26 votes
1 answer
26k views

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; ^ ...
J G's user avatar
  • 363
26 votes
6 answers
53k views

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 ...
Kirill Morozov's user avatar
25 votes
4 answers
19k views

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: ...
Benny Powers's user avatar
  • 5,706
25 votes
5 answers
20k views

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 ...
NiloCK's user avatar
  • 601
24 votes
2 answers
4k views

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 ...
Max Komarychev's user avatar
23 votes
0 answers
3k views

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 ...
Tom's user avatar
  • 8,028
22 votes
3 answers
15k views

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 ...
Ray Booysen's user avatar
  • 29.6k
21 votes
3 answers
16k views

Lerna specify run order

In my monorepo, I have 3 packages package1, package2, package3, each package contains a npm script named build. However, these packages are not linked together. I.e. there are no require() in any of ...
jeanpaul62's user avatar
  • 10.3k
20 votes
2 answers
16k views

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) ...
Undistraction's user avatar
19 votes
2 answers
4k views

Are there any advantages to using Lerna with Yarn workspaces?

We're in the process of migrating our monorepo to use Lerna. Lerna supports both NPM and Yarn and furthermore allows configuration of use with Yarn workspaces. It's unclear to me whether Lerna with ...
axelyung's user avatar
  • 463
18 votes
3 answers
15k views

Why does Yarn throw "Invariant Violation: expected workspace package to exist" when I attempt to upgrade some dependencies?

I have a monorepo that is managed by lerna which relies on the Yarn workspaces feature. It looks like this: /repo |-- packages | |-- pkg-a | | |-- package.json | |-- pkg-b | | |--...
customcommander's user avatar
16 votes
2 answers
25k views

How to install packages in just one package.json file in Yarn workspaces?

I have the classic Lerna set up. root directory, packages folder, 2 subdirectories I want to just run yarn install inside one package and just to install the dependencies for this package. for some ...
Red Baron's user avatar
  • 7,419
15 votes
1 answer
19k views

Lerna, yarn, and Typescript: Cannot find module or its corresponding type declarations

I have a lerna + yarn workspaces monorepo, with independent versioning. I'm having trouble importing a package in its sibling. I have two packages, one of which should depend on the other, as ...
James's user avatar
  • 740
15 votes
3 answers
8k views

How to avoid install of packages in monorepo using Yarn

I built a monorepo using Lerna and Yarn workspaces. Everything works fine but everytime I install a new dependency on a package (let's call him A) using: yarn add <package_name> Yarn adds it ...
Erazihel's user avatar
  • 7,545
15 votes
1 answer
4k views

VSCode - Lerna - Typescript - Monorepo Code Navigation

We have a monorepo for all our Javascript related SDKs here at Sentry. https://github.com/getsentry/sentry-javascript If you clone this repo, set it up properly with yarn install and then open any ...
HazA's user avatar
  • 1,324
15 votes
4 answers
13k views

How do I load a package from a package in a Lerna monorepo?

I have: packages -models -package.json -.... -server -src -index.ts -package.json In my packages/server/package.json, I have: "scripts": { "dev": "ts-node src/index.ts" },...
Shamoon's user avatar
  • 42.8k
15 votes
2 answers
19k views

Lerna. Install dependencies to root project

I have standard Lerna repository like this: my-repo - package.json - packages - api - package.json - web-app - package.json If I need same dependency in both packages (for example ...
WelcomeTo's user avatar
  • 20.3k
14 votes
6 answers
20k views

"'rootDir' is expected to contain all source files" in monorepo

I'm working on converting a large(ish) monorepo into TypeScript for a client, however, I'm pretty new to TS myself and have run into an error that I can't find an obvious fix for. TS6059: File '[path ...
Alex Foxleigh's user avatar
14 votes
2 answers
7k views

Single ESLint setting for all Lerna sub repositories?

I have heard somewhere that it's possible to create just one ESlint preset for all Lerna subrepositories, but when begin to collect info actively about this did not found clear information. Why it's ...
Takeshi Tokugawa YD's user avatar
14 votes
1 answer
4k views

lerna link vs. lerna bootstrap

I have a Lerna project which until recently was using lerna bootstrap --hoist. This worked well but I found the devDependencies in the many sub folders were mostly identical. Upgrading to Lerna v3 I ...
user2965155's user avatar
13 votes
3 answers
8k views

Use Lerna with React Native?

Is it possible to use Lerna (lernajs.io) with React Native? I'm attempting to create new project with the following structure: MyApp packages myapp-core myapp-mobile myapp-web lerna ...
samcorcos's user avatar
  • 2,408
12 votes
4 answers
11k views

lerna add : No packages found where <package> can be added

have added lerna to my project, i have added a package to my server by running this command successfully: lerna add @types/express --dev But when I want to add another one: lerna add graphql class-...
Amir Meyari's user avatar
12 votes
2 answers
26k views

Lerna bootstrap does not link local dependencies?

What is the proper way of working with lerna and local dependencies? I have configured two modules in a mono repo to use lerna with a local dependency. I expected that $ lerna bootstrap $ lerna run ...
matsev's user avatar
  • 33.3k
12 votes
1 answer
2k views

How do I share context between a library component, and my application component?

I'm using lerna to create a monorepo where I'd have a structure like this: root packages application - Our root application components - Just some react components, that are to be used ...
dwjohnston's user avatar
  • 12.4k
11 votes
1 answer
10k views

"Lerna List" and "Lerna Changed" Returns 0 Packages

Gist I have a monorepo and I am using yarn workspaces and lerna to manage it. I had no issues with it until now. I need to know all the changed packages since the last release. Issue So I run lerna ...
Florian Ludewig's user avatar
11 votes
2 answers
9k views

How to package only the dist folder in a monorepo

I am using lerna and yarn workspaces in my monorepo. The package structure looks like this: root `--- packages |--- pkg1 | |--- src | | `--- index.ts | `--- dist |...
Naresh's user avatar
  • 25.2k
11 votes
1 answer
3k views

Enforcing shared dependencies in a monorepo

We have a monorepo using lerna and yarn workspaces. Multiple teams contribute packages to it and there are some common dependencies where we want to force people to use the same version. What are the ...
adanilev's user avatar
  • 3,268
11 votes
1 answer
2k views

separating commit messages between modules of a monorepo

I have a fullstack project like this: myProject packages myProjectCommon myProjectFrontEndApp1 myProjectFrontEndApp2 myProjectBackEnd I use Lerna so that I can ...
Lev's user avatar
  • 15.2k
11 votes
0 answers
3k views

How to generate per-package package-lock.json for existing Lerna mono-repo

We have an existing Lerna mono-repo that has a structure like: / /packages /package1 /package2 /package3 ... We currently use Yarn for our project, and actually only have a top-...
Matthew Herbst's user avatar
10 votes
5 answers
12k views

Lerna always lists all packages ready to publish when running workflow of Github actions

Lerna does not correctly detect packages change during running workflow of Github actions. If I make none packages related changes, commit and runlerna updatedlocally. it tells me No changed packages ...
eded's user avatar
  • 3,918
10 votes
1 answer
10k views

Configure Lerna to publish NPM packages to private Gitlab repo

I'm doing some tests with Lerna to create a mono-repo with a bunch of packages that I'd like to share with some applications. I've followed Lerna's documentation to setup a project and this is the ...
Fel's user avatar
  • 4,668
10 votes
1 answer
7k views

How do I update all subfolder package.json in a monorepo to the same version?

I have a repository with a bunch of different front-end React projects, which all have package.json files of their own. I have four requrements: I want to keep all of these projects on the same ...
InspectorDanno's user avatar
10 votes
1 answer
3k views

How to Share Build Scripts In Lerna Packages

I have a lerna repo that contains multiple packages organised in the usual structure: package.json /packages - alpha package.json - bravo package.json - charlie package.json I need ...
Undistraction's user avatar
10 votes
3 answers
9k views

Debugging a lerna-typescript project in VSCode

I'm trying to build a monorepo using lerna+typescript, I'm using this repo as a start: https://github.com/Izhaki/mono.ts What i'm trying to achieve is to debug the code inside visual studio code. I'...
MajinDageta's user avatar
10 votes
0 answers
1k views

create-react-app + gatsby packages in monorepo won't both run

I'm trying to create a monorepo with these packages: a web app created using create-react-app a gatsby site a library of components etc. that the web app and gatsby app will share (which is my main ...
toranpetto's user avatar
10 votes
2 answers
5k views

Lerna with watch tasks - lerna run --parallel

I have three packages: A, depends on C B, depends on C C When using lerna run build, C builds before A and B (good!) But when I start a watch task lerna run watch, C never completes and therefor A ...
Mick's user avatar
  • 8,773
10 votes
0 answers
860 views

How do you share uncompiled typescript between React Native and Next.js in a monorepo?

I have settled a monorepo with Lerna and Yarn Workspaces with this structure: project | - packages | - ReactNativeApp | - NextJsApp | - FirebaseCloudFunctions | - Common | - ...
Xiiryo's user avatar
  • 3,207
9 votes
3 answers
8k views

Run specific jest project

I'm setting up a lerna monorepo with jest, I'm using jest's projects like so: projects: ['<rootDir>/packages/*']. Running tests work as expected, however, I'm not sure how can I run a specific ...
donzul's user avatar
  • 445
9 votes
1 answer
4k views

Lerna / Nx / Turborepo or other monorepo systems for non-js apps (php)

I have repository with /frontend (JS/Vue) and /backend (PHP) and docker-compose.yml for development. But now I need to add another JS frontend that will be sharing some components, libs etc. I do not ...
norr's user avatar
  • 2,042
9 votes
2 answers
10k views

Yarn Link All Packages/Workspaces

Yarn's link allows you to register a local package for symlinking into another local package. To use link you cd into the package directory and run yarn link. This works fine on individual packages, ...
Undistraction's user avatar
9 votes
2 answers
4k views

Interrupt all lerna --parallel tasks at once

I have a lerna script (lerna dev) that boots up several package's dev servers with the --parallel option (if I didn't use that option, only the first service would start, but not the others). These ...
Gabriel Theron's user avatar
9 votes
1 answer
4k views

Prioritize build order with yarn workspaces and lerna

I have this big typescript project in a mono-repository using yarn workspaces and lerna with the following architecture: repo ├── API │ └── (GraphQL API) ├── Apps │ └── (Front-end React Apps) ├── ...
Marco Daniel's user avatar
  • 5,715

1
2 3 4 5
14