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.

`lerna bootstrap` tries to build dependency in the wrong order, so dependent build fails

See original GitHub issue

It appears that lerna links a local project A into a local project B, but does not run the build step of project A before it tries to build project B, so project B’s build fails because it can not resolve the modules from project A because it does not have its dist folder.

Expected Behavior

Lerna should build A before B.

Current Behavior

Lerna doesn’t, and so B’s build fails.

Possible Solution

Steps to Reproduce (for bugs)

git clone --recursive git@github.com:infamous/umbrella.git
cd umbrella
git checkout lerna-issue-2453
lerna bootstrap
lerna.json

{
        "packages": ["apps/*", "packages/*"],
        "version": "independent"
}

lerna-debug.log

None.

Context

I was trying out lerna for the first time in an existing repo that has multiple projects. Each project is a git submodule.

Could the fact that the projects I have in apps/* and packages/* are git submodules be throwing of Lerna’s build algo?

Your Environment

Executable Version
lerna --version 3.20.2
npm --version 6.13.6
yarn --version N/A
node --version 13.8.0
OS Version
Manjaro Linux rolling release

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:11

github_iconTop GitHub Comments

1reaction
ShishKababcommented, Mar 23, 2022

This is what I’ve been using successfully for the last years to run prepare scripts in the right order: https://gist.github.com/ShishKabab/51ae7b6aab9292f865de0ee238c26052

1reaction
GiancarlosIOcommented, May 5, 2021

So, is there a workaround for this issue? I’m manually installing and building the “primitive” packages first and then running yarn lerna bootstrap to build all packages without problems. 😢

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Lerna with unpublished packages - Stack Overflow
Whenever lerna cannot match a dependency to a local package, it'll try to install it from the registry. So ensure that the dependency...
Read more >
Getting Started | Lerna
The dependencies will be rebuilt only when they change. Otherwise, their dist folders will be kept as is.
Read more >
Error Codes | Yarn - Package Manager
A list of Yarn's error codes with detailed explanations. ... Indeed, in order to build a package, we first must make sure that...
Read more >
Things I wish I had known when I started JavaScript monorepo ...
Lerna will find out which packages have build npm script defined and then it determines their order of execution. The order is determined...
Read more >
Create a monorepo with Lerna | by Damian Cyrus - Medium
The command lerna bootstrap installs all dependencies within all ... if you are depending on another package and if that needs to be...
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