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.

Orphaned child processes keep running when exiting `lerna run` with an error

See original GitHub issue

I’m running the command lerna run --stream --parallel start and if one of the apps has an error the others can be left running even as the lerna process exits.

Expected Behavior

I expect all child processes to be killed when lerna exits.

Current Behavior

Lerna orphans processes

Possible Solution

I’m not familiar enough with the code 😦

Steps to Reproduce (for bugs)

  1. Create the default project
  2. Create two apps, one is a simple nodejs express app, the other try exit 1 in the “start” script in package.json
  3. lerna run --stream --parallel start

The fact that the nodejs app starts fine but the other app exits is causing the node.exe process to be orphaned.

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

Context

I just want to call npm start and have it start multiple apps in my mono repo. Then press Ctrl+C to stop them all, repeat.

Your Environment

I am running on windows, I have seen this behavior in both WSL and git bash. One of my apps just has docker-compose up as the script which starts up some containers like my db. If docker isn’t running then this crashes for this reason. Also my app runs ngrok which also becomes orphaned.

Executable Version
lerna --version 3.15.0
npm --version 6.10.2
yarn --version N/A
node --version v12.8.0
OS Version
Windows 10 Pro 1903

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:19
  • Comments:38 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
yinzaracommented, Oct 7, 2021

I saw this issue’s fix PR has been merged but not released, when is the next release, BTW last release was 7 months ago 😐

We tested this version with our repository and it caused other issues of the process continually respanwning.

Downgrading to Lerna 3.22.1 seems to fix this issue. For now anyone who wants to use Lerna in a Windows environment should probably lock their dependency to that version.

4reactions
fahrulseptianacommented, Jan 21, 2022

any update? facing the issue on windows 11 with lerna 4.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna adding command exits with the error of not related ...
npm install exited 1 in '@devell-platform/model' lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately. lerna ...
Read more >
@lerna/child-process | Yarn - Package Manager
This would result in the commands continuing to run with unexpected configuration. Going forward, lerna will exit non-zero immediately upon encountering these ...
Read more >
@lerna/validation-error: Versions | Openbase
Interactive configurtion for lerna run caching and task pipelines via the new lerna ... utils: orphaned child process on Windows (#3156) (7e69e9e) ...
Read more >
Lerna Kill Background Processes In Yarn Workspace?
Runs currently executing tasks to completion before exiting.This prevents the risk of having orphaned child processes running after lage has ...
Read more >
Troubleshooting | Lerna
... as a client may have suffered from the bootstrap process not being able to run properly. Error running command. error Command failed...
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