-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm uninstall throws 404 for unpublished siblings #1229
Comments
When working with lerna-managed packages, running npm commands directly in a managed directory ( Currently, removing a dependency in a lerna-managed package requires manual editing of package.json and re-running In the future I hope to add a |
Hmm you would also have to manually remove it from the Anyway, as a work around for anyone else experiencing this issue: You need to temporarily change the sibling references in Change module-a From:
To:
Then run the local npm uninstall. After which you must change it back otherwise lerna will hang. |
@jennasalau My apologies, I forgot a step. I have been using Anyway: Run The normal behavior of npm recognizing changes to package.json and manipulating package-lock.json to match will be restored when Once again, my apologies. Thank you for having the patience to document a workaround! We (I, actually) could really use help implementing the |
@evocateur I'd be happy to help improving the documentation. I've been facing similar issues when removing or upgrading a dependency comes into the game. Although, I'm not sure what are the current best practices for removing and upgrading. If you could provide some bullet points of what needs to be done, I can come up with some documentation for them. |
If we stopped mangling the package.json files so badly during bootstrap, we would have a better story. Also, supporting the relative `file:` protocol (which would require resolution during publish) would make it all “just work”, for the most part.
To instruct folks that manually editing package.json files is the “best practice” for modifying dependencies goes against my strongly-held belief that you _should_ always use the various npm subcommands when doing those sorts of things. I realize it is certainly _possible_ to manually edit and get (mostly) what you expect in a normal npm package scenario, but in my experience it is a lot more brittle and prone to breakage. Lerna definitely changes the context significantly.
Here are the bullet points, such as they are:
To remove
• Edit the target package.json, removing the dependency
• Run `lerna bootstrap` in the root
To add
• If hoisting, `npm i <dependency>` in root
• Edit the target package.json, adding the dependency (if hoisting, just copy the line from the modified root package.json)
• Run `lerna bootstrap` in the root
To upgrade (semver major):
• If hoisting, `npm i <dependency>@latest` in root
• Edit the target package.json files, upgrading the dependency version (if hoisting, just copy the line from the modified root package.json)
• Run `lerna bootstrap` in the root
To update (when package-locked):
• Same as semver major upgrade, except when hoisting, call `npm up <dependency>` in root instead of install.
… On Jan 24, 2018, at 06:37, Thomas Lefebvre ***@***.***> wrote:
@evocateur I'd be happy to help improving the documentation. I've been facing similar issues when removing or upgrading a dependency comes into the game. Although, I'm not sure what are the current best practices for removing and upgrading. If you could provide some bullet point of what needs to be done, I can come up with some documentation for them.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks for the bullet points! For the "remove", however, I ended up having to do this: (using example module name "my-module")
using v2.9.0 and not using hoisting |
@aweber1 Thanks, that's good to know. I kinda dry-coded my bullet points 😅 I'm planning on implementing |
Teaching people in a team to run multiple command to just remove one package is an extra overhead 😢. Is it in plan to implement this anytime soon? @evocateur |
@kamleshchandnani Well, there is a "help wanted" tag on this issue. I don't have many spare cycles these days, so we're at the mercy of folks pitching in to help implement these commands. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@evocateur Can you please keep this open? |
The stale bot seems to be disregarding my commands. Such is the inevitable end with robots, it seems. |
Coming back to lerna + npm from yarn workspaces this is a rather big surprise. Uninstalling/installing in packages seems like such a core task of a mono repo manager. Most annoying is to have to update package.json files manually, lookup version numbers, etc. |
Manually linking local packages has become a pain. |
I dunno, I consider managing packages a core competency of a package manager, which Lerna is not. pnpm has great support for workspaces, you might check it out. |
Take the following project dependency structure
cd
'ing into module-a and attempting to uninstall dependency-a:Gives the following error:
For some reason (guessing clean up), NPM re-evaluates the dependent packages on a
uninstall
which blow's away any sym links resulting in this 404?Potentially related to: npm/npm#17025
Expected Behavior
I would expect dependency-a to uninstall and module-a
packages.json/lock
files to update.Current Behavior
npm uninstall behaviour is exited and the module is not removed.
Possible Solution
Open an issue with NPM?
Find or document a work around.
Your Environment
lerna --version
npm --version
node --version
The text was updated successfully, but these errors were encountered: