I'm seeing warning " > my-library@1.0.0" has unmet peer dependency "react@^18.2.0". even though the package which depends on my-library has the react defined in its "dependencies".
Note that this can be worked around by adding "react": "^18.2.0" to the root package's package.json, however this is not a good solution since that's not how things are supposed to be configured, and it introduces duplication between root's package.json and my-app's package.json.
Versions
% yarn -v
1.22.19
% npm -v
8.5.0
Related issues
There seems to be some related issues, but they seem to be closed many years ago or about something slightly different. For example, #5810 was slightly different as it was talking about dev-dependencies, and also the resolution of this (use yarn 2) is unsatisfactory for me since I use expo, which recommends yarn classic.
Bug
I'm seeing
warning " > my-library@1.0.0" has unmet peer dependency "react@^18.2.0".
even though the package which depends onmy-library
has thereact
defined in its"dependencies"
.my-app's package.json:
my-library's package.json:
Reproduction
For a simple repro, see here: https://github.com/chriscoomber/yarn-workspace-peer-dependency-repro/
Note that this can be worked around by adding
"react": "^18.2.0"
to the root package's package.json, however this is not a good solution since that's not how things are supposed to be configured, and it introduces duplication between root's package.json and my-app's package.json.Versions
Related issues
There seems to be some related issues, but they seem to be closed many years ago or about something slightly different. For example, #5810 was slightly different as it was talking about dev-dependencies, and also the resolution of this (use yarn 2) is unsatisfactory for me since I use expo, which recommends yarn classic.