-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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] Incorrect dependency version in mono repo #8136
Comments
Theoretically, all this npm installation is done on Theoretically, if I was cornered in this position, I would script the desired setup, put correct things in correct places using Sorry I can't fix npm cli. I came for my own problem with npm, saw yours, and thought I'll chip in my 2p quick. Best luck! |
@reggi Thanks for looking into this. I'm also able to run the example. That is not the issue. The issue is that they don't use the correct versions as mentioned in their package.json What do you get when you run I get this:
But I expect @astrojs/react@4.2.0 -> react-dom to be version 19.0.0 |
i'm gonna close this one for now, feel free to repoen |
@Klaasvaak sorry I closed without noticing your comment, I get this:
and I know mine isn't dedouped because it's not hoisted |
@Klaasvaak perhaps its your version of npm? |
you can also delete all node_modules folders in your project and reinstall? |
@reggi I don't know why you closed this issue. Your cli output clearly shows something is wrong as well:
This should be |
@reggi fyi, I don't have permission to reopen this issue. |
i got your issue now, you should have included overrides in the stackblitz example |
workspaces are special and npm installs aren't idempotent, context matters and shapes how package-lock will look that being said you may have originally npm installed your packages individually and built up the lock one way, and now you're stuck. react-dom is a dev dep of astro's plugin it shouldn't have control over your version. this all being said if you:
I believe you get what you want without overrides:
|
@reggi Thank you for looking further into this. react-dom is a devDependency of astro, but it's also a peerDependency. I choose to use the latest (v19) react-dom instead of v18. Shouldn't astro therefor also use react-dom v19 in my example because that's what it says it supports in their peerDependencies and that's what I put as a version in the package.json? |
There are no overrides in the stackblitz example, should there be? When I remove all node_modules and the lockfile and run npm i again in the stackblitz example I get:
Still using v18. Is this the devDependency? But shouldn't it be the peerDependency? Which version will astro use now? |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I originally posted this issue in Astro because I thought it was an Astro issue, but I think this is an npm issue.
Describe the Bug
In my mono repo using npm I have 2 apps:
apps/demo
apps/documentation
The documentation app uses astro with react, I followed the steps from the Astro documentation. This should use react version 19.
The demo app uses create react app with react version 17.
When I run the documentation app I get the error
When I run
npm ls react-dom
in the root of my mono repo I get the following result showing astrojs/react is using react-dom version 17 instead of 19.I added an overrides to my root package.json:
Now when running npm ls react I get:
None of this seem to solve the error. Any ideas?
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-bqrrwddb?file=package.json
Note about the stackblitz demo. I wasn't able to fully reproduce this, I'm not getting the error but I do get unexpected react-dom version when running npm ls react-dom in the root:
Expected Behavior
Use the correct react version.
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: