Questions tagged [lerna]
Lerna is a tool designed to help develop JavaScript projects in a single git repo containing multiple related npm packages.
lerna
659
questions
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 ...
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 ...
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 ...
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 : ...
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 ...
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' ...
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 ...
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:
...
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;
^
...
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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) ...
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 ...
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
| | |--...
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 ...
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 ...
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 ...
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 ...
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"
},...
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 ...
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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
|...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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 ...
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'...
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 ...
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 ...
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
| - ...
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 ...
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 ...
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, ...
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 ...
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)
├── ...