-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[package.json+yarn] How to deal with the numerous "@aws-cdk/aws-*" unmet peer dependency
warnings
#9832
Comments
Seems like this is a Have you checked |
Yup, they are installed.
If I depend on @aws-cdk/aws-ecs which in turns depends on 22(!) peer dependencies, and my code could break if I forget to add an explicit dependency on all of them, are these 22 peer dependencies not, in fact, actual transitive dependencies, and should not be declared as peer dependencies but 'real' dependencies in @aws-cdk/aws-ecs? |
Because they are dependencies of your dependencies, it throws a warning because it needs to be hoisted by the package manager. If you tried it with npm, it would do the same hoisting, but without printing the most of the warnings. So no, you won't need to explicitly add the peer dependencies. (Welcome to JS lol) |
Ok, but say, I import I don't care, since I'm not using KMS. This, to me, points to the real problem, that peerDependencies have not been declared as optional (when applicable). Looking at "dependencies": {
...
"@aws-cdk/aws-kms": "1.60.0",
...
},
....
"peerDependencies": {
...
"@aws-cdk/aws-kms": "1.60.0",
...
}, Should there not be as well: "peerDependenciesMeta": {
"@aws-cdk/aws-kms": {
"optional": true
}
} I think this would remove the warning and make the intent clear, as long as only optional peer dependencies are marked optional of course. |
This will be solved in 2.0 of the AWS CDK. We are planning to release the entire CDK as a single module ( Here you can find more information about monolithic packaging. We will consider annotating our deps with |
Any update on adding the optional annotation? I architect across many applications for a large enterprise and our migration to 2.0 will not be immediate. In the meantime, as an example, a very small project I'm involved with is getting 62 warnings of this type. When warnings become spam, developers ignore warnings. I believe we can all agree, that is not a desirable outcome. |
I come from the java world and try to reduce my dependencies to the exact set that I need.
So I'm not an npm / yarn expert, but the verbosity I'm having to deal with in the context of installing aws-cdk modules
is a bit intimidating.
When I do a fresh yarn install, I get lots of peer dependencies warnings. What am I supposed to do about it?
If there is nothing I can do about it, how can I avoid seeing these warnings (and indeed why are they warnings at all)?
I think this is more of a generic npm / yarn question, but still, I want to know how people deal with this in the context of the aws-cdk, where each imported module has many peer dependencies, causing many such warnings. I don't like those, they keep reminding me that I'm either doing something wrong, or that yarn is using the wrong level of logging...
Input appreciated, thanks.
package.json
fragmentyarn install
output fragmentThe text was updated successfully, but these errors were encountered: