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 commands occasionally delete package source code

See original GitHub issue

Not enough information to be helpful, but I want to capture what we are experiencing in case more details arise or others can help diagnose.

Expected Behavior

lerna should not delete source code

Current Behavior

We are still struggling to find a pattern or trigger, but across several engineers and a couple of our projects that use lerna, now and then (a few times a month?) after running npm install, or a lerna command, one of our package directories will be deleted. We just revert the deletion in local git before committing, but it’s disconcerting and has caused some minor intermediate changes to be lost that had to be re-done.

Possible Solution

Maybe something with a clean following symlinks when it shouldn’t or something? It does seem to be a small set of packages that are deleted, not random, but some timing trigger or dependency trigger? But a few of our packages seem to be the ones more likely to be deleted, but it’s not always the same one.

Steps to Reproduce (for bugs)

I wish we knew.

It happened a couple times when lerna add failed with cb() never called! error, which we get fairly regularly, but we chalk that up to a npm bug. So I thought perhaps that was the trigger, but we’ve had it happen since then without that npm error, so probably a red herring.

lerna.json

{
  "command": {
    "publish": {
      "ignoreChanges": [
        "**/package-lock.json",
        "**/jest.config.js",
        "*.md",
        "**/tests/**",
        "**/Demo/**",
        "**/Details/**"
      ]
    },
    "diff": {
      "ignore": [
        "**/package-lock.json",
        "**/jest.config.js",
        "*.md",
        "**/tests/**",
        "**/Demo/**",
        "**/Details/**"
      ]
    }
  },
  "packages": ["packages/*"],
  "version": "independent"
}

Context

We have 3 projects using lerna, one large one with 40-ish packages, one with several and one with just a couple packages. It happens the most in the large one it seems, but hard to know because it gets worked on the most and exercised the most as well, so size may not be relevant. It has happened in the medium one once. Haven’t seen it in the small one yet. There are lots of interdependencies between the packages with sometimes different versions as dependencies.

Your Environment

npm with package-locks disabled postinstall runs: "bootstrap": "lerna bootstrap --hoist --no-ci -- --no-package-lock --loglevel error",

Executable Version
lerna --version 3.20.2
npm --version 6.13.4
node --version v12.16.0

| OS | Version | | NAME | VERSION | | macOS Mojave | 10.14.6 | | macOS Catalina | 10.15? |

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
redbugzcommented, Mar 3, 2020

I have a reproducible case in a local folder now. I can get it to delete a package every time I run lerna bootstrap. It always deletes the same package in this case. It looks like it might be caused by different dependency versions. When I get some time, I will try and debug it and identify what is triggering the deletion.

0reactions
github-actions[bot]commented, Jun 17, 2022

Hi Folks 👋

You will have seen in our message above that we at Nrwl are working really hard to bring the lerna repo up to date with what matters most to its community in June 2022.

As previously stated in that message, because we have not heard from the original author of this issue within the last 14 days, we are now automatically closing it.

If any users, including the original author, are still impacted by this issue then we still want to hear from you!

All we ask is that you first update to the latest lerna (5.1.4 at the time of writing) to make sure it is still reproducible, and then fill out one of our new issue templates, providing all the requested details which apply to your situation:

https://github.com/lerna/lerna/issues/new/choose

Many thanks again! 🙏


P.S. Over and above getting to grips with the repo, we have also been hard at work launching a new website, resolving all vulnerabilities, merging exciting new features and reigniting community PR contributions! 🚀

You can read our recent blog post to learn more about what we’ve been up to: https://blog.nrwl.io/lerna-5-1-new-website-new-guides-new-lerna-example-repo-distributed-caching-support-and-speed-64d66410bec7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature: lerna remove · Issue #1886 - GitHub
Currently there's no way to remove a dependency from a lerna package, the closest way we can do is to manually remove from...
Read more >
Lerna You a Monorepo: The Nuts and Bolts of Building a CI ...
The lerna import command maintains history, but it is designed for migrating an entire repository into a single package in the monorepo.
Read more >
How to deploy only changed packages in a Lerna Monorepo
Deploy only changed packages. The only command you need to know is “lerna run” , it simply runs an npm script in each...
Read more >
Make your Lerna smarter - Purple Technology Blog
There is also an option --deleteTagOnSuccess which simply looks for the most recent tag generated by this package and deletes it if smart...
Read more >
@lerna/list | Yarn - Package Manager
@lerna/list. owner lerna5.5mMIT6.2.0. List local packages. lerna, command ...
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