问题
On the phase where yarn is linking its dependencies I get the following block of warnings:
warning "firebase > @firebase/database@0.2.2" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/firestore@0.4.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/functions@0.1.1" has unmet peer dependency "@firebase/app-types@0.x".
...
some more unment peer dependency
warnings about "@firebase/app-types@0.x"
from different firebase packages I removed here for the sake of better readability.
...
warning " > flotjs@0.1.3" has unmet peer dependency "dom-tools@^0.1.1".
warning " > flotjs@0.1.3" has unmet peer dependency "wolfy87-eventemitter@^4.3.0".
Even though I did read The docs about dependency types, I still do not understand:
1) What are peer dependencies? [now I do... please read edit below]
2) Why and how are they used? [now I do... please read edit below]
This lack of understanding also leads to me being uncertain about what I should do about those warnings provided by yarn.
3) Should I add @firebase/app-types@0.x
, dom-tools@^0.1.1
and wolfy87-eventemitter@^4.3.0
as dependencies?
4) if so then should those be normal or dev dependencies?
Edit:
It was suggested that this is a duplicate of Why use peer dependencies in npm for plugins? so I went and read it. I now understand better what peer dependencies are in general and I do recommend everyone reaching this Q that does no understand what peer dependencies are to go ahead and read said Question and answer provided there.
Never the less, I still don't know how to resolve said warning and Q's 3 and 4 are still let unanswered for me.
I do understand that @firebase/firestore@0.4.1 expects me to somhow use that code in @firebase/app-types@0.x when communicating with it... but I do not knwo where, when am I how I am expected to do so.
The fact that I don't use it could mean that its something optional that I don't actually need and this makes it "an implementation detail" (to use language from https://stackoverflow.com/a/34645112/25412 ) or that I am missing something in how I am using @firebase/firestore@0.4.1.
I am not asking about the peer dependencies of plotjs because plotjs is not something that I am using directly to begin with so I am guessin the first option of an optional "implementation detail" applies here (at least for now).
So maybe someone can provide more insight into what @firebase/app-types@0.x does and how and when it can/should be used?
回答1:
According to one of the collaborators maintaining the firebase javascript sdk, this warning is generated by a known bug in yarn. See this related issue in the firebase-js-sdk:
After a quick google search, It appears to be a known issue with yarn. If a peer dependency is installed by a dependency's dependency (I know it's a mouthful), yarn will complain about it. Your product is totally safe, there is nothing to worry about. You can also use npm install instead, and there is no warning.
In conclusion: ignore the "@firebase/..." has unmet peer dependency "@firebase/app-types@0.x".
warnings.
来源:https://stackoverflow.com/questions/50112353/what-does-firebase-app-types0-x-do-and-when-should-i-use-it