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
├─┬ demo@14.1.1 -> ./apps/demo
│ ├── react-dom@17.0.2
│ └─┬ react-router-dom@6.29.0
│ └── react-dom@17.0.2 deduped
└─┬ documentation@0.0.1 -> ./apps/documentation
├─┬ @astrojs/react@4.2.0
│ └── react-dom@17.0.2 deduped
└── react-dom@19.0.0
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
├─┬ demo@14.1.1 -> ./apps/demo
│ ├── react-dom@17.0.2 overridden
│ └─┬ react-router-dom@6.29.0
│ └── react-dom@17.0.2 deduped
└─┬ documentation@0.0.1 -> ./apps/documentation
├─┬ @astrojs/react@4.2.0 overridden
│ └── react-dom@17.0.2 deduped invalid: "^19.0.0" from node_modules/@astrojs/react
└── react-dom@19.0.0
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
+-- demo@0.1.0 -> ./apps/demo
| `-- react-dom@17.0.2
`-- documentation@0.0.1 -> ./apps/documentation
+-- @astrojs/react@4.2.0
| `-- react-dom@18.3.1
`-- react-dom@19.0.0
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