lerna commands occasionally delete package source code
See original GitHub issueNot 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:
- Created 4 years ago
- Reactions:1
- Comments:5
Top GitHub Comments
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.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