-
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] Overrides are not applied correctly with workspaces #4834
Comments
I have the same issue with some serverless lambdas. I added an override to the root package.json for aws-sdk, but it still installs the incorrect version:
|
@villelahdenvuo did you find a solution for this. Our whole build seems to be broken and overrides are the only solution available so any help is very welcome. |
@zanemcca Nope, I ended up forking the aws-lambda-ses-forwarder so that I can add the |
I have also tried to fork my dependency and change the versions to use I would really like to see this important feature work as documented. Is there any way someone can take a look at this? The only workaround right now is to fork the dependency that contains the bad version and update the version to an exact package version that matches what you need. Not only is this a ton of work for developers in the easiest of cases but it is likely to be much worse if the offending package version is deeply nested. |
facing same issue with my project, is there a fix planned for this ? |
Just migrated to npm from yarn workspace were we used EDIT: Found #4517 which explains some parts |
Still actual. npm workspaces and npm overrides don't work together correctly? ./package.json
My workaround: ./package.json
|
This is actually blocking monorepo adoption with npm. This is kind of a serious issue, esp. since the overrides means we can't manually pin a peer dep's version, and could lead to security issues. |
And even with the override on the root package, it still doesn't work, so I'm not sure how the person above saying #4517 "fixes it" got it to work. |
I can confirm that it still does not work on Node 20 with npm 9.8.1. I have the overrides in the root package as #4517 indicates. As mentioned by @JaneJeon this blocks monorepo adoption. EDIT: A "solution that works" is using |
Seems like it's time to use pnpm... |
Not certain but I think I'm probably having the same issue. What I wanted to do was to override a package in my monorepo to point to a github repo. This is so that we can work against development branches of our internal dependencies without having to publish them to npm or use npm link. I tried, and tried, and tried, but could not get the override to be respected. In fact, I couldn't get the github repo to be respected at all unless all instances of this dependency in all package.jsons were also changed to point to the github repo. But, my overrides for react 18 work fine (thank God!) so my experience therefore is also some sort of situational behavior. I'll have to revert to using npm link (P.S. Take a look at yarn link and use of portals. It's more transparent and a lot less friction than npm link.) |
10.7.0 overrides still do not work correctly |
I've been maintaining a monorepo for quite some now, using lerna earlier, now npm workspaces, and now I need to override a single dependency of a single package - only to find out that I can't, without using |
@isaacs Can someone on the main team take a look at this. It feels like a serious limitation of the mono-repo abilities. This is something that shows up very easily for any applications that use monorepos at scale and it has been a thorn in our side for a few years at this point. |
For anyone reading this later, I applied a workaround in the end - by directly copying the package whose dependencies I could not override to my project, then installing whatever versions of dependencies I wanted. It sure is dumb, but at least it works. Might not work for larger libraries. |
We got the same problem |
This worked for me:
Individual package.json override did not worked. Root override did work but it was causing other issues due to package mismatch.
Which results in:
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When overrides are applied to a project with workspaces, they do not consistently apply.
Expected Behavior
Overrides should apply regardless of the usage of workspaces.
Steps To Reproduce
trim
should be at version0.0.3
, while it is stuck at0.0.1
Environment
; copy and paste output from `npm config ls` here
The text was updated successfully, but these errors were encountered: