when running yarn install, what does it mean when a module doesn't provide another?

Viewed 2603

when i run yarn on my react app that uses firebase, i will get several warnings like...

@firebase/auth@npm:0.14.5 [c52f6] doesn't provide @firebase/app-types@0.x requested by @firebase/auth-types@npm:0.10.0

myapp@workspace:. doesn't provide @testing-library/dom@>=5 requested by @testing-library/user-event@npm:10.2.0

(fyi... i am using yarn v2)

does this mean i need to explicitly add those to my package.json?

2 Answers

The error code for this is YN0002, see the official documentation explaining this error.

It is regarding peer-dependencies which are dependencies that are typically loaded with another dependency (its peer) at a specific version.

In summary, this is an error that can only be fixed by the package author. As an end-user, you won't be able to apply any of the recommendations as mentioned in the official documentation.

As an update to the top answer, it is fixable with yarn packageExtensions. You can manually declare a package with another dependency/peerependency in the yarnrc.yml file.

https://yarnpkg.com/configuration/yarnrc#packageExtensions

ex:

@testing-library/user-event@*:
    dependencies:
        @firebase/app-types: "^0.x.x"

or

@testing-library/user-event@*:
    peerDependenciesMeta:
        @firebase/app-types:
            optional: true
Related