-
Notifications
You must be signed in to change notification settings - Fork 3.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
[BUG] Updating package in workspace
child project to the already hoisted version does not remove old version from the child node mods
#3071
Comments
workspace
child project to the already hoisted version does not remove old version from the child node mods
I'm running into the same issue on my project. Hoping for a fix soon. |
Workaround might be to remove package-lock and try reinstalling. I think the core problem here is that it treats the package-lock as the source of truth and not at the package.json in the workspace. Maybe there's a way to update the package-lock with the updated linked version, or npm should ignore package-lock for workspace packages. |
@timoxley |
@vgarba3 can you try replicating this problem on the latest version of |
@darcyclarke Yep seems to be working as expected now - thanks |
Current Behavior:
When using workspaces if two child projects share the same dependency but different versions the highest version (App1) is hoisted to the root nod_mods and the project (App2) with the lower version installs the package to its local node mods. The issue is that when / if the project (App2) with the lower version installed decides to upgrade its package to match the version that is already hoisted, that package is not removed from the lower/local node_mods, and it still resolves to the lower package version and can not be upgraded (with out manual work).
When upgrade App2 some-lib@1.0.0 => @1.1.0, some-lib@1.0.0 is left in App2 node_mods
NOTE: version upgrade made through updating the package.json version, not the CLI
Expected Behavior:
When updating a projects dependencies, if the new package version matches the existing hoisted package version, the existing outdated package in the local child node_mods should be removed to allow the project to resolve to the hoisted package.
When upgrade App2 some-lib from @1.0.0 => @1.1.0, @1.0.0 should be removed from its node_mods
Steps To Reproduce:
Test Repo: https://github.com/vgarba3/vg-npm-workspaces-deps
Notice that App2 can not resolve its updated version, and maintains it lower outdated package in its node modules.
Environment:
The text was updated successfully, but these errors were encountered: