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.

reopen bootstrap removes node_modules from root (during hoist)

See original GitHub issue

Hi, this is a vote to repopen https://github.com/lerna/lerna/issues/889#issue-237423886 which was closed due to inactivity.


Can you provide an example repo? I’m a bit mystified by the context of this error. (https://github.com/lerna/lerna/issues/889#issuecomment-312334120)

Say we have a lerna repo which contains of two packages “p1” and “p2”:

{
  "name": "p1",
  "dependencies": {
    "lodash": "latest"
  }
}

and

{
  "name": "p2",
  "dependencies": {
    "underscore": "latest"
  }
}

and now one executes:

lerna bootstrap --hoist --include-dependencies --scope p1

…then lodash is hoisted to the root’s node_modules,

Now one executes:

lerna bootstrap --hoist --include-dependencies --scope p2

…then lodash disappears from the root’s node_modules and instead underscore is hoisted.

It would be great if this could be controlled via a flag, e.g. --keep-existing-node-modules.

It is often desired to keep already existing node_modules in the root when working on several projects at the same time and it is annoying if one project removes the deps of another project.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
endreymarcellcommented, Mar 10, 2020

Thanks for the answer. Our monorepo hosts multiple independent frontend components in separate packages (but with shared dependencies). So our main use case is bootstrapping some packages, but not all of them. My understanding is that if we were to switch to yarn or pnpm workspaces, we could only bootstrap the entire monorepo all at once, which is something we want to avoid. But do correct me if I’m wrong. Also, for dependencies within the monorepo, we need to be able to tell what version of another package our package depends on. We lose that information with relative file file: specifiers.

0reactions
evocateurcommented, Mar 7, 2020

lerna bootstrap --hoist is a brilliant, complicated hack that was necessary when it was written (almost) four years ago. It is now no longer necessary because package managers have either implemented workspaces or plan to in near future (with acceptable workarounds in the meantime). You should use these alternatives instead of lerna bootstrap:

Read more comments on GitHub >

github_iconTop Results From Across the Web

npmrc
Hoisting to the root modules directory means that application code will have access to phantom dependencies, even if they modify the resolution strategy ......
Read more >
How to clean node_modules folder of packages that are ...
Now I want to clean node_modules folder so that only modules listed in package.json stay there and the rest must go, something like...
Read more >
Visual Studio Code September 2022
You can now hide actions from tool bars. Right-click on any action in a tool bar and select its hide command or any...
Read more >
WindPRO 2.7 User Guide
Generally, each chapter is divided in a theoretical part describing models and methods, and a part describing how to use the software. Module...
Read more >
Untitled
The root cause was a bug in IPA (#1596161) - Backport patches to add ... [of] of: __of_detach_node() - remove node from phandle...
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