Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/[email protected] 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?

like image 983
brewster Avatar asked May 20 '20 08:05

brewster


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.

like image 182
Janac Meena Avatar answered Oct 16 '22 17:10

Janac Meena


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
like image 1
Ben Gooding Avatar answered Oct 16 '22 17:10

Ben Gooding