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 swallows stdout and stderr output from NPM client

See original GitHub issue

When running lerna bootstrap, any output (e.g., logs, warnings, errors) from the underlying NPM client are swallowed. This results in failed bootstraps without knowing the reason the underlying client exited with a non-zero status code. Also, warnings like misconfigured peer dependencies are never displayed to the end user.

Expected Behavior

Running lerna bootstrap should pass through output from the underlying NPM client.

Current Behavior

lerna bootstrap swallows all output from the underlying NPM client.

Possible Solution

If it’s not desired to make lerna bootstrap more verbose, perhaps only stderr can be let pass through and stdout can be enabled by adding a new --npm-client-stdout flag?

Steps to Reproduce (for bugs)

  1. Set up a Lerna project using lerna init
  2. Create a new package using lerna create
  3. Add a non-existent dependency to the newly created package’s package.json
  4. Run lerna bootstrap
lerna.json

{
  "lerna": "2.9.0",
  "version": "independent",
  "npmClient": "yarn"
}

Context

I’m managing private packages in a monorepo and often there are issues with local dependencies not being resolved by the underlying NPM client. lerna bootstrap fails silently without a clear indication of what the error is.

Your Environment

Executable Version
lerna --version 3.20.2
npm --version 6.4.1
yarn --version 1.18.0
node --version 10.14.2
OS Version
macOS Catalina 10.15.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:20
  • Comments:10

github_iconTop GitHub Comments

4reactions
djvscommented, Mar 20, 2020

👍 Stuck investigating random hangs for the last hour with no solution to see where npm install is hanging.

1reaction
frosascommented, Jul 12, 2021

Looking at the code couldn’t see any user option that could change that behavior.

If you need to troubleshoot bootstrap issues I’d suggest to temporarily replace that stdio = "pipe" for a stdio = "inherit":

https://github.com/lerna/lerna/blob/a47fc294393a3e9507a8207a5a2f07648a524722/utils/npm-install/npm-install.js#L17

@evocateur would you accept a PR making inherit the default?

Read more comments on GitHub >

github_iconTop Results From Across the Web

One vs. many — Why we moved from multiple git repos to a ...
From what we encountered, lerna run swallows the output of the npm scripts. With the --stream flag, we get the output but it's...
Read more >
Source - GitHub
[5.6.2](https://github.com/lerna/lerna/compare/v5.6.1...v5.6.2) (2022-10-09) ### Bug Fixes ... **run:** Re-order --npm-client in help output ...
Read more >
webpack/webpack - Gitter
I'd like to import html into a JS file after the html file has been compiled, and particularly after it's run through HtmlWebpackPlugin....
Read more >
2020-October.txt - SuSE Lists
(bsc#1148236) - sbd-md: Make list/dump failures go to stderr. ... to RES bootstrap repo for Centos (bsc#1174423) spacewalk-client-tools: - Remove duplicated ...
Read more >
https://gitee.com/opengauss/openGauss-connector-no...
+ +### 7.15.0 + +- Change repository structure to support lerna & future monorepo [development](https://github.com/brianc/node-postgres/pull/2014).
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