-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unmet peer dependency warning when the peer dependency is installed at the same time #2132
Comments
Can confirm this. I've got while doing
|
Same here with
|
Same issue. |
low priority? |
Would you like to send a PR to fix it? |
do you have any idea what part(s) of the Yarn code the PR would have to touch (potentially)? :) |
Not really :-). I'd just recommend searching for the error message string and then seeing where it's used. |
After some debugging, and using Line 315 in 4e4075f
this.resolver.getResolvedPattern(pattern) is expecting a However, what's passed is just I was able to fix it successfully using this code: for (const name in peerDeps) {
const range = peerDeps[name];
const packageInfo = this.resolver.getAllInfoForPackageName(name)
const hasAnyPackageVersion = packageInfo.length !== 0
const foundDep = packageInfo.find((entry) => this._satisfiesPeerDependency(range, entry.version))
if (foundDep) {
ref.addDependencies([`${foundDep.name}@^${foundDep.version}`])
} else {
const depError = hasAnyPackageVersion ? 'incorrectPeer' : 'unmetPeer';
const pkgHuman = `${pkg.name}@${pkg.version}`,
depHuman = `${name}@${range}`;
this.reporter.warn(this.reporter.lang(depError, pkgHuman, depHuman));
}
} But this line Any pointers how I should approach it? |
I believe this issue can be closed. Updating to yarn 0.22 (from 0.21.3) resolved this for me. |
Agreed, fixed in #2801 🎉 |
Works fine! |
Indeed, this works correctly in |
Bug
What is the current behavior?
Installing a dependency and its peer dependency at the same time generates a warning "Unmet peer dependency" even though the peer dependency is installed.
Steps to reproduce:
On the other hand, first running
yarn add react
and thenyarn add react-dom
doesn't create any warnings.What is the expected behavior?
No warnings about peer dependencies should be printed when other packages specified in the
add
command will satisfy the peer dependencies.Please mention your node.js, yarn and operating system version.
Node.js v6.9.1
Yarn 0.17.10
macOS 10.12.1
The text was updated successfully, but these errors were encountered: