Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
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
Missing "./server.js" specifier in "react-dom" package
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.
root
├─┬ [email protected] -> ./apps/demo
│ ├── [email protected]
│ └─┬ [email protected]
│ └── [email protected] deduped
└─┬ [email protected] -> ./apps/documentation
├─┬ @astrojs/[email protected]
│ └── [email protected] deduped
└── [email protected]
I added an overrides to my root package.json:
"overrides": {
"@astrojs/react": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4"
}
}
Now when running npm ls react I get:
root
├─┬ [email protected] -> ./apps/demo
│ ├── [email protected] overridden
│ └─┬ [email protected]
│ └── [email protected] deduped
└─┬ [email protected] -> ./apps/documentation
├─┬ @astrojs/[email protected] overridden
│ └── [email protected] deduped invalid: "^19.0.0" from node_modules/@astrojs/react
└── [email protected]
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:
my-monorepo@ /home/projects/github-bqrrwddb
+-- [email protected] -> ./apps/demo
| `-- [email protected]
`-- [email protected] -> ./apps/documentation
+-- @astrojs/[email protected]
| `-- [email protected]
`-- [email protected]
Expected Behavior
Use the correct react version.
Steps To Reproduce
- https://stackblitz.com/edit/github-bqrrwddb?file=package.json
- npm ls react-dom
- See react-dom version is not as expected
Environment
- npm: 10.9.2
- Node.js: v22.14.0
- OS Name: MacOS
- System Model Name: Macbook Pro 2024
Activity